.netWinfrom 问题!!!! 求一个方法,在winfrom 里面能实现 关闭计算机,重启等操作!!!!!!!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 C#控制计算机关闭、重新启动、注销2007年11月30日 星期五 11:16//设置注销、关闭、重新启动计算机参数 [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.net的Ajax分页例子来看看呀! 如何确定local machine是否能访问某特定url 请教: 如何打开文件 读取数据库? 急!!请问这是什么问题:”Automation服务器不能创建对象“,现在已经不能创建任何C#项目了 如果用户登录超过一定时间,就将该用户踢出,该怎么办 如何通过 mailto: 设置附件? C#在WINDOWS应用程序和WEB应用程序调用DATAGRID控件代码是否一致啊 dataGrid的问题 Timer控件一直刷新一条信息 讨论C#软件模块升级
[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");
}