2012-12-13 40 views
5

不知有人知道如何用c#命令打开这个盒子吗?关闭windows box C#

enter image description here

提前感谢!

+0

它在这里某处:http://msdn.microsoft.com/en-us/library/windows/desktop/ff818516%28v=vs.85%29.aspx –

+1

如果你只是想要登录用户关: [SO注销编程] [1] [1]:http://stackoverflow.com/questions/484278/log-off-user-from-win-xp-programmatically-在-C-尖锐 –

回答

5

您必须添加引用的Shell32.dll(COM - > “微软壳牌控制和自动化”),并使用此代码:

Shell32.Shell shell = new Shell32.Shell(); 
shell.ShutdownWindows(); 
2

添加引用C:\ WINDOWS \ SYSTEM32 \ Shell32.dll中。执行此操作后,请使用以下代码:

Shell32.ShellClass sc = new Shell32.ShellClass(); 
sc.ShutdownWindows(); 

这将正常显示关机对话框。