Results 1 to 5 of 5

Thread: ExitWindowsEx problem

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2002
    Posts
    18

    Question ExitWindowsEx problem

    Hey, I found the ExitWindowsEx i the AllAPI Guide and thought it was pretty cool, but I can't get it to run because it says that it wants ExitWindowsEx to be a variabel.

    Here's the code:

    'In general section
    Const EWX_LOGOFF = 0
    Const EWX_SHUTDOWN = 1
    Const EWX_REBOOT = 2
    Const EWX_FORCE = 4
    Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long
    Private Sub Form_Load()
    'KPD-Team 1998
    'URL: http://www.allapi.net/
    'E-Mail: [email protected]
    msg = MsgBox("This program is going to reboot your computer. Press OK to continue or Cancel to stop.", vbCritical + vbOKCancel + 256, App.Title)
    If msg = vbCancel Then End
    'reboot the computer
    'Problem is in this line I think
    ret& = ExitWindowsEx(EWX_FORCE Or EWX_REBOOT, 0)
    End Sub

    -----

    I think it says that, because there is () after ExitWindows, but it says so in the guide example.
    Thanks for your help.
    -Nack
    Last edited by Nack; Feb 3rd, 2002 at 04:40 AM.

  2. #2

    Thread Starter
    Junior Member
    Join Date
    Feb 2002
    Posts
    18
    Do you know the right declaration then?
    -Nack

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Feb 2002
    Posts
    18
    You wrote the exact same declaration as in the example!

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Feb 2002
    Posts
    18
    The error message marks the text: ExitWinsdowsEx and says this:
    Compile Error:
    Sub or Function not defined

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Feb 2002
    Posts
    18
    I got it working now!

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