用vb.net实现关机、重启、注销功能 大家好,小弟是一个刚接触C#的初学者,现在遇到这样的一个问题,请大家帮帮忙,问题是用C#如何实现关机、重启、注销功能? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 //设置注销、关闭、重新启动计算机参数 [DllImport("user32.dll", EntryPoint = "ExitWindowsEx", CharSet = CharSet.Ansi)] private static extern int ExitWindowsEx(int uFlags, int dwReserved); //注销计算机 public void logout() { ExitWindowsEx(0, 0); } //关闭计算机 public void closepc() { //创建访问控制本地系统进程的对象实例 System.Diagnostics.Process myprocess = new System.Diagnostics.Process(); myprocess.StartInfo.FileName = "cmd.exe"; myprocess.StartInfo.UseShellExecute = false; myprocess.StartInfo.RedirectStandardInput = true; myprocess.StartInfo.RedirectStandardOutput = true; myprocess.StartInfo.RedirectStandardError = true; myprocess.StartInfo.CreateNoWindow = true; myprocess.Start(); myprocess.StandardInput.WriteLine("shutdown -s -t 0"); } //重新启动计算机 public void afreshstartpc() { //创建访问控制本地系统进程的对象实例 System.Diagnostics.Process myprocess = new System.Diagnostics.Process(); myprocess.StartInfo.FileName = "cmd.exe"; myprocess.StartInfo.UseShellExecute = false; myprocess.StartInfo.RedirectStandardInput = true; myprocess.StartInfo.RedirectStandardOutput = true; myprocess.StartInfo.RedirectStandardError = true; myprocess.StartInfo.CreateNoWindow = true; myprocess.Start(); myprocess.StandardInput.WriteLine("shutdown -r -t 0"); } asp 添加记录时,在文本框中写了一个链接代码添加到数据库中,如何在网页上显示为链接的形式 vb自定义广播消息的问题,spy++看了下根本没有 运行错误 字符串长度问题 关于delphi转换成vb 请大家帮忙看看这样的报表是怎么做出来的 Document对象 鼠标WM_LBUTTONDOWN时GetCapture为空? VB当中的句柄是一什么样的概念? 木马程序中两个难题? 答对大送分 ! 关于LABEL标签组回应鼠标点击的问题 WebBrowser获取鼠标停留在一个超链上时的地址
[DllImport("user32.dll", EntryPoint = "ExitWindowsEx", CharSet = CharSet.Ansi)]
private static extern int ExitWindowsEx(int uFlags, int dwReserved);
//注销计算机
public void logout()
{
ExitWindowsEx(0, 0);
}
//关闭计算机
public void closepc()
{
//创建访问控制本地系统进程的对象实例
System.Diagnostics.Process myprocess = new System.Diagnostics.Process();
myprocess.StartInfo.FileName = "cmd.exe";
myprocess.StartInfo.UseShellExecute = false;
myprocess.StartInfo.RedirectStandardInput = true;
myprocess.StartInfo.RedirectStandardOutput = true;
myprocess.StartInfo.RedirectStandardError = true;
myprocess.StartInfo.CreateNoWindow = true;
myprocess.Start();
myprocess.StandardInput.WriteLine("shutdown -s -t 0");
}
//重新启动计算机
public void afreshstartpc()
{
//创建访问控制本地系统进程的对象实例
System.Diagnostics.Process myprocess = new System.Diagnostics.Process();
myprocess.StartInfo.FileName = "cmd.exe";
myprocess.StartInfo.UseShellExecute = false;
myprocess.StartInfo.RedirectStandardInput = true;
myprocess.StartInfo.RedirectStandardOutput = true;
myprocess.StartInfo.RedirectStandardError = true;
myprocess.StartInfo.CreateNoWindow = true;
myprocess.Start();
myprocess.StandardInput.WriteLine("shutdown -r -t 0");
}