|
-
Aug 7th, 2000, 02:22 PM
#1
Hi,
I need to intercept the windows Shutdown event and Cancel it depending on the user input.
I have tried using the AbortSystemShutdown API but its not working. I have tried setting the lpMachineName variable to my machine name (AbortSystemShutdown "abc").
I am using Windows 2000.
Thanks in advance.
I am trying the following code :
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If UnloadMode = vbAppWindows Then
ans = MsgBox("Are you sure you want to shutdonw the computer ?", vbYesNoCancel)
If ans = vbYes Then
AbortSystemShutdown ""
End If
End If
End Sub
-
Aug 9th, 2000, 06:35 AM
#2
Member
Ok, abortsystemshutdown is not intended for the way you are using it. AbortSystemShutdown is coupled with InitiateSystemShutdown which is designed to allow you to remotely shutdown computers on a network (NT/2000 ones only), abortsystemshutdown allows you to stop the system from shutting down after the InitiateShutdown command has been run.
Sorry for breaking the bad news to you
Grant French
-----------------------------------------------
E-Mail: [email protected]
ICQ: 33122184
-
Mar 8th, 2011, 10:48 AM
#3
New Member
Re: Help with AbortSystemShutdown
actually it works, and not only after the command InitiateSystemShutdown..
Declare:
Code:
Declare Auto Function AbortSystemShutdown Lib "advapi32.dll" _
(ByVal lpMachineName As String) As Boolean
Call:
Code:
AbortSystemShutdown("localhost")
I created the program to automatically abort the shutdown when i open it.. because i have an annoying 'ShutDown' button next to 'Enter'..
But it doesn't work quite sure.. so i created a button to call the same function, and only after pressing it after 10 times it did actually stopped from shutting down..
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
|
Click Here to Expand Forum to Full Width
|