Hai,
I've to detect when the system is shutdown or logged off using VB. Could anyone help me out with the code for this. or suggest some APIs used
Thank you,
Regards,
K. Sripriya
Printable View
Hai,
I've to detect when the system is shutdown or logged off using VB. Could anyone help me out with the code for this. or suggest some APIs used
Thank you,
Regards,
K. Sripriya
I suppose you could just have a form open and use the QueryUnload event.
Here's what crptcblade means
VB Code:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) Select Case UnloadMode Case vbFormControlMenu MsgBox "The user chose the Close command (the ""X"") from the Control menu on the form." Case vbFormCode MsgBox "The Unload statement is invoked from code." Case vbAppWindows MsgBox "The current Microsoft Windows operating environment session is ending." Case vbAppTaskManager MsgBox "The Microsoft Windows Task Manager is closing the application." Case vbFormMDIForm MsgBox "An MDI child form is closing because the MDI form is closing." Case vbFormOwner MsgBox "A form is closing because its owner is closing." End Select End Sub
Does he mean "system" as a Computer or an Application?
You can also subclass a form but I don't remember the messages you are supposed to look for...