c#dos命令关机重启注销代码求译
using System;using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;//此名字间是用来干嘛使得?
using System.Diagnostics;//此名字间是用来干嘛使得?
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnguanji_Click(object sender, EventArgs e)
{
try
{
Process.Start("Shutdown.exe", "-s -t 0");//Process.Start是什麽?
}
catch (Exception ex)//Exception ex是什麽?
{
MessageBox.Show(ex.Message);//这个是什麽?
}
}
private void btnchongqi_Click(object sender, EventArgs e)
{
try
{
Process.Start("shutdown.exe", " -r -t 0");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
[DllImport("user32.dll", EntryPoint = "ExitWindowsEx", CharSet = CharSet.Ansi)]//这个是什麽?
private static extern int ExitWindowsEx(int uFlags, int dwReserved);//这个是什麽?
private void btnzhuxiao_Click(object sender, EventArgs e)
{
ExitWindowsEx(0, 0);//这个是什麽?
}
private void btnzidongguanji_Click(object sender, EventArgs e)
{
Process.Start("Shutdown.exe -s -t 3600");
}
}
}
望高手们给力相助!小女子无以为报!