Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stop Windows Shut Down

Status
Not open for further replies.

CasperTFG

Programmer
Nov 15, 2001
1,210
US
I think this has been answered before but I can't seem to find it.

I Want to stop windows from being shut down if something hasn't happened.

When windows shuts down it tries to close the program I made the program with the code running in the unload event so when it tries to unload it the code is fired fine. Now all I need is the command to tell windows to cancel the shutdown. Craig, mailto:sander@cogeco.ca

Remember not to name the Lambs...
It only makes the chops harder to swallow
 
If you are using the event that I think you are, it should have a variable with it (Cancel As Integer).

If you change Cancel to equal one(1) it should cancel the window unload:

---------------------------------------------

Private Sub Form_Unload(Cancel As Integer)
...
Cancel = 1
...
End Sub

---------------------------------------------

Hope that helps.
- Bill
 
Public Declare Function AbortSystemShutdown Lib "advapi32.dll" Alias "AbortSystemShutdownA" (ByVal lpMachineName As String) As Long

I have Never User It But It Is API Put It In!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top