Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Display the showdown dialog

Posted on 2004-10-27
Medium Priority
Last Modified: 2012-06-27
I am working on a hardware project and one of the functions of the device is to bring up the Window shutdown dialog, the user then selects the option they want just like they would if they selected start -> shutdown.
It seems its easy enough to shut down the computer directly but I can't find any solution to just display the standard dialog.  

Question by:horrid
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 13

Expert Comment

ID: 12431397
And what about duplicating this dialog? A combo with 4 or 5 elements should not be too difficult. It will only be your design and not the standard OS one in that case.

Author Comment

ID: 12431805
I am trying to avoid too much in the way of custom interfaces.  The user should not have constant reminders that they are running some special hardware device.  

In VB it looks like you can do it like this
Private Declare Function SHShutDownDialog Lib "shell32" Alias "#60" (ByVal something As Long) As Long

SHShutDownDialog 0

I'm still new to C++ and have no idea how to convert that over.  

I'll would like to avoid a custom dialog if I can, the hardware device is not ment to be obvious that you are running it.
LVL 12

Accepted Solution

OnegaZhang earned 800 total points
ID: 12432051
typedef int (CALLBACK *SHUTDOWNDLG) (int);
HINSTANCE hInst = LoadLibrary("shell32");
   SHUTDOWNDLG SHShutDownDialog;
   if(hInst != 0)
   //get the address of SHShutDownDialog
   SHShutDownDialog = (SHUTDOWNDLG)GetProcAddress(hInst, (LPSTR)60);
LVL 55

Assisted Solution

by:Jaime Olivares
Jaime Olivares earned 200 total points
ID: 12433831
The answer is here:

I suppose is an OnegaZhang's page.
There are some extra characters. Clean answer (the same) is this:

    typedef int (CALLBACK *SHUTDOWNDLG) (int);
    HINSTANCE hInst = LoadLibrary("shell32");
    SHUTDOWNDLG SHShutDownDialog;
    if(hInst) {
        SHShutDownDialog = (SHUTDOWNDLG)GetProcAddress(hInst, (LPSTR)60);

It is exactly equivalent to the Visual Basic solution you've posted.

Good luck,

Author Comment

ID: 12440163
Thanks!  This has opened me up to an entire new world!  Seeing how to implement a shell32 api call was by far the more important thing I got out of this.

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question