How do I exit/restart Windows from my VB program?


    First declare this function:
    Declare Function ExitWindows Lib "User" (ByVal RestartCode As Long,ByVal DOSReturnCode As Integer) As Integer

    Now use one of these three functions to make what you want.

    Result = ExitWindows(67, 0) 'reboot the computer
    Result = ExitWindows(66, 0) 'restart Windows
    Result = ExitWindows(0, 0)  'just exit Windows
    

    Don't use this function in the VB-environment without saving! ;)



Mail to Daniel Wiman <daniel@wimania.com>
Online since June 1996, updated 971025
<- The VB home
<- Daniels homepage