2012-12-13 38 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(); 

這將正常顯示關機對話框。