README.md
December 5, 2022 ยท View on GitHub
Description
This stops the system from shutting down when windows goes to shut down...
More Info
| Submitted On | |
| By | Dan Dayon |
| Level | Beginner |
| User Rating | 4.8 (29 globes from 6 users) |
| Compatibility | VB.NET |
| Category | Miscellaneous |
| World | .Net (C#, VB.net) |
| Archive File |
Source Code
'Constants
Private Const WM_QUERYENDSESSION As System.Int32 = &H11
Private Const WM_CANCELMODE As System.Int32 = &H1F
'And the Sub itself....
Protected Overrides Sub WndProc(ByRef m As Message)
If m.Msg = WM_QUERYENDSESSION Then
'Check the m, if it's trying to shut down, don't send it. Send a new message cancelling it.
Dim x As New Message
x.Msg = WM_CANCELMODE
MyBase.WndProc(x)
Else
'Otherwise, just send the message.
MyBase.WndProc(m)
End If
End Sub