How do I shut down the computer using VB code?

How do I shut down windows? In vb..


Comments

  • Hi,

    You can restart windows, using the following code.

    Declare the following in the decleration section of your form:

    Declare Function ExitWindows Lib "User" (ByVal RestartCode As Long, ByVal DosReturnCode As Integer) As Integer


    Then: i = ExitWindows(66, 0)


    I hope this helps, have a great day!


    Sincerely,

    Jason Gorman


    Jason Gorman (Jason_Gorman@scholars.com)

    Learning Advisor, http://scholars.com

    Microsoft Authorized Technical Education Center

    Novell Authorized Online Training Provider


    ----original message----


    : How do I shut down windows? In vb..





  • : How do I shut down windows? In vb..




    'For windows 95 or better,

    'Another way is to run this code

    Shell("c:windows
    undll.exe user.exe,exitwindows")


    'If you want to reboot, you can run this code:

    Shell("c:windows
    undll.exe user.exe,exitwindowsexec")





Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories