windowswinapishutdown

Windows shutdown dialog


Is there a way to bring up the Windows XP shutdown dialog (the one with the three buttons – Suspend, Shutdown, Restart and Hibernate when Shift is pressed) using any language (preferred: C/C++, VB, Haskell, batches)?

I think I can load the msgina.dll in my C++ program, but I dunno what to do next – what function in the dll is used to show the dialog?


Solution

  • Assuming that your language has a way to do basic file I/O and invoke shortcuts on Windows, try this tip from here:

    • Create a new txt file somewhere on your system, open it and put in this one line: (new ActiveXObject("Shell.Application")).ShutdownWindows();
    • Save and close the file. Change the extension to *.js.
    • You can make a shortcut to that file to make it easy to shut down your system.