Display the System Reboot Dialog

When Windows installs new software, it often displays a message explaining system settings have changed and that a reboot is required.

Instead of coding your own restart functions, why not simply plug into the standard with this little-known API call?

Simply call the SettingsChanged method, passing the Form to display the message as an argument. The user will then be prompted to reboot the machine.

Ideal after any critical file changes, updates and so on.

Usage

SettingsChanged Form1

Code

Private Declare Function SHRestartSystemMB Lib _
"shell32" Alias "#59" (ByVal hOwner As Long, ByVal _
sExtraPrompt As String, ByVal uFlags As Long) As Long

Private Const SystemChangeRestart = 4

Public Sub SettingsChanged(FormName As Form)
    SHRestartSystemMB FormName.hWnd, vbNullString, SystemChangeRestart
End Sub


Asterisk Equipment Dealer | Wood Blinds | Characals | Shades | Ms. Pacman