Archive for the ‘Shutdown’ Tag

VB Net – Detect Windows Shutdown

Private Const WM_QUERYENDSESSION As Integer = 17

Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
MyBase.WndProc(m)
If m.Msg = WM_QUERYENDSESSION Then
Application.Exit()
End If
End Sub