DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 9 of 9

Thread: shut down and restart command

  1. #1
    Join Date
    Aug 2004
    Posts
    43,023

    shut down and restart command

    [Originally posted by ah_fai]

    can i make windows shut down or restart when a button is clicked? can anyone pls tell me the code for this command?

  2. #2
    Join Date
    Aug 2004
    Posts
    43,023

    Re:shut down and restart command

    [Originally posted by Mrugendra Bhure]

    Wel,
    You will have to use the API function ExitWindowsEx to restart your machine. The code will be

    'In your form

    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 Command1_click()
    dim val as long

    val=ExitWindowsEx(EWX_FORCE Or EWX_REBOOT, 0)
    end sub

  3. #3
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:shut down and restart command

    [Originally posted by ah_fai]

    what about shutting down the com?

  4. #4
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:shut down and restart command

    [Originally posted by ah_fai]

    i want to do a timer program which will eventually shut down by itself after the timer has reached 0. i mean, i set the time... then it will countdown until to 0 hours 0 minutes and 0 seconds. then, it will shut down by itself. this will be very useful if i am away while i am downloading a large file. pls... can anyone tell me what is the code for shuting down the computer?

  5. #5
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:Re:shut down and restart command

    [Originally posted by Mrugendra Bhure]

    I sent you the command, man
    just copy its contents and paste in the timer events code.

    Regards
    Mrugendra

  6. #6
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:Re:Re:shut down and restart command

    [Originally posted by ah_fai]

    the command u sent to me is for restarting the computer. can u pls tell me the command for shutting down the computer?

  7. #7
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:Re:Re:shut down and restart command

    [Originally posted by ah_fai]

    can anyone pls tell me the code for SHUT DOWN windows? thx Mrugendra. the code u gave me is for restarting windows. it is useful too but now i need to know the code for SHUT DOWN windows...

  8. #8
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:Re:Re:Re:shut down and restart command

    [Originally posted by Mrugendra Bhure]

    same code is useful for shuting down windows just change the parameter value to 1
    so the changed function is
    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 Command1_click()
    dim val as long

    val=ExitWindowsEx(EWX_FORCE Or EWX_SHUTDOWN, 0)
    end sub

  9. #9
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:Re:Re:Re:Re:shut down and restart command

    [Originally posted by ah_fai]

    thx very much!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center