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 

devx-admin

Share the Post: