devxlogo

Display the “Shut down Windows” dialog

Display the “Shut down Windows” dialog

To programmatically display the “Shut down Windows” standard dialog box you can use the SHShutDownDialog undocumented API function, whose declaration is:

Declare Function SHShutDownDialog Lib "shell32" Alias "#60" (ByVal lType As _    Long) As Long

Its only argument can be one of these constants:

Public Const EWX_LOGOFF = 0Public Const EWX_SHUTDOWN = 1Public Const EWX_REBOOT = 2Public Const EWX_FORCE = 4Public Const EWX_POWEROFF = 8

But in most cases you can get along passing the EWX_SHUTDOWN value, as in:

SHShutDownDialog EWX_SHUTDOWN 

See also  Professionalism Starts in Your Inbox: Keys to Presenting Your Best Self in Email
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist