Results 1 to 2 of 2

Thread: [RESOLVED] help in shut down a machine

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2006
    Posts
    30

    Resolved [RESOLVED] help in shut down a machine

    hey people,

    Somebody please help in turning off a computer...
    the code is as follows....

    Private Const EWX_LogOff As Long = 0
    Private Const EWX_SHUTDOWN As Long = 1
    Private Const EWX_REBOOT As Long = 2

    Private Declare Function ExitWindowsEx Lib "user32" _
    (ByVal dwOptions As Long, _
    ByVal dwReserved As Long) As Long

    Public Sub LogOff()
    Dim llResult As Long
    llResult = ExitWindowsEx(EWX_LogOff, 0&)
    End Sub

    Public Sub ShutDown()
    Dim llResult As Long
    llResult = ExitWindowsEx(EWX_SHUTDOWN, 0&)
    End Sub

    Public Sub Reboot()
    Dim llResult As Long
    llResult = ExitWindowsEx(EWX_REBOOT, 0&)
    End Sub

    i am able to log off the computer but not able to turn off and reboot the system. I am using visual basic 6.0 in windows Xp professional with the firewall turned off

    please help its urgent

  2. #2
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: help in shut down a machine

    here is 1 of 53 examples of this, when I searched 'shutdown restart' @ www.pscode.com/vb

    http://www.pscode.com/vb/scripts/Sho...45593&lngWId=1
    Chris

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