-
Cancel Windows Shutdown Process
[Originally posted by Eric Cranston]
OK, I am trying to cancel a system shutdown, so basically a user clicks :start>shutdown computer: and this code that I am trying to write kills the shutdown process, acting like the user never clicked shutdown.* I'll take anything that'll work vb6 or vb .net (both would be great), anyways I am stuck, I can get programs to shutdown the computer, but the only way I've found to stop the computer from shutting down is by hitting cancel when programs ask to save something, so how do I cancel the shutdown process with my program?!
Thank you in advance, sorry for going on and on
-
Re:Cancel Windows Shutdown Process
[Originally posted by m.posseth]
i have to go to work in a few minutes so first the VB6 vrsion :-)
i could show you how to acomplish this with subclassing and reading registry values
however this hould also work
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
* * If UnloadMode = vbAppWindows Then ' we're shutting down
* * * * If MsgBox("Stop shutdown?", vbYesNo) = vbYes Then
* * * * * * Cancel = True ' to stop shutdown
* * * * End If
* * End If
End Sub
-
Re:Re:Cancel Windows Shutdown Process
[Originally posted by Eric Cranston]
I'm not at home so I can't try it right now, but will that work if I get rid of the message box, I want to do it without user interaction, and I hope (not sure if possible) that I cna also get it to stop force shutdowns (these are shutdowns that simply kill programs rather then go though there unload processes), anyways thanks
-
Re:Re:Re:Cancel Windows Shutdown Process
[Originally posted by m.posseth]
hmmmm
it works .... if you just remove the message box lines
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
* * If UnloadMode = vbAppWindows Then ' we're shutting down
* * * * * * * * * Cancel = True ' to stop shutdown
'* * * * * End If
end sub
hmmmm this wil help a bit in acomplishing your task
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Select Case UnloadMode
Case vbAppWindows: Cancel = True
Case vbAppTaskManager: Cancel = True
Case vbFormOwner: Cancel = True
End Select
* *
* *
*
End Sub
but if the user is a administrator on the machine and uses the taskmanager twice in a row to try to kill the process windows will terminate the process ( after giving a warning screen )
hmmm it should be much harder to stop if you made your proggy invissible in the taskmanager ( or run as a service )
however it is an will always be possible to write a proggy that can kill a runing process if the user that is logged on to the computer has administrative priviliges* * ( and this is how it should be in my opinion )
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks