Results 1 to 3 of 3

Thread: Help with AbortSystemShutdown

  1. #1

    Thread Starter
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    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

  2. #2
    Member
    Join Date
    Aug 2000
    Posts
    60
    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

  3. #3
    New Member
    Join Date
    Mar 2011
    Posts
    1

    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
  •  



Click Here to Expand Forum to Full Width