Hello,
I found (at
http://uk.builder.com/programming/wi...0271637,00.htm) the
following code to close vb.net application when system shutdown is
initiated:
Const WM_ENDSESSION As Integer = &H16
Dim osexit As Boolean = False
Protected Overrides Sub WndProc(ByRef e As Message)
If (e.Msg = WM_ENDSESSION) Then
osexit = True
Application.Exit()
End If
MyBaseProc(e)
End Sub
When I put the code in a sample application and initiated shutdown (win xp
sp1), the
application closed, but the shutdown failed. System event log showed event
1073, "The attempt to power off <machine name> failed"
I did not modify the message, why did it fail?
thanks,
Vadim Rapp