Is there a way to display the Windows shutdown dialog box from c#?
I found a command that I can use with System.Diagnostic.Process.Start
taskkill /im explorer.exe
But doesnt works on Windows 8
Is there a way to display the Windows shutdown dialog box from c#?
I found a command that I can use with System.Diagnostic.Process.Start
taskkill /im explorer.exe
But doesnt works on Windows 8
You could use shutdown.exe instead of trying to kill explorer.:
shutdown.exe /i /t 0
I haven't tried calling it from a C# process, but shutdown /i
pulls a GUI on Windows 8 for me. Note that it isn't the same UI though.
I know it's an old question, but for those searching for an answer, at least in recent Windows systems (propably also in older ones) a good solution is to send a WM_CLOSE message to the window with classname "progman", this will trigger the default cancelable Windows shutdown dialog as shown in the screenshot above. In plain C this would be:
SendMessage(FindWindow(_T("progman"), NULL), WM_CLOSE, 0, 0);