Thread: Displaying the Shut Down Windows dialog

  1. #1
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,273

    Red face Displaying the Shut Down Windows dialog

    Hi,
    I was wondering if there is a function that will display the Shut Down Windows dialog. Apparently, in VB you can declare function "#60" in shell32.dll and it'll come up, but how do you do that in C/C++?

  2. #2
    Registered User (TNT)'s Avatar
    Join Date
    Aug 2001
    Location
    UK
    Posts
    339
    Hi,

    Im not 100% sure, but i think as its part of the shell it would be hard to do in c++. So what you should do it make your own dlg and simply use ExitWindowsEx(), it would not be to hard to create your own shutdown dlg box.

    Cheers
    TNT
    TNT
    You Can Stop Me, But You Cant Stop Us All

  3. #3
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,273

    Talking

    Yes! I figured it out!

    I first have to use LoadLibrary to get the module handle for the DLL, then GetProcAddress to get the address for the function, like so:-
    Code:
    FARPROC SHShutdownWindows;
    HMODULE hShellDll;
    
    hShellDll = LoadLibrary("shell32.dll");
    SHShutdownWindows = GetProcAddress(hShellDll, MAKEINTRESOURCE(60));
    Then, by calling the function:-
    Code:
    (*SHShutdownWindows)(0);
    I get a rather spiffy Shut Down Windows dialog. Easy when you know how :P

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Question..
    By pode in forum Windows Programming
    Replies: 12
    Last Post: 12-19-2004, 07:05 PM
  2. First-time Windows programming
    By Grayson_Peddie in forum Windows Programming
    Replies: 5
    Last Post: 06-05-2002, 11:09 PM
  3. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM
  4. Displaying a picture on a dialog
    By CodeMonkey in forum Windows Programming
    Replies: 2
    Last Post: 02-14-2002, 11:14 AM