Results 1 to 4 of 4

Thread: Soft reboot in windows 98?

  1. #1


    You know how you can hold down shift while you restart, and it will do a "soft" reboot, by only restarting windows? I want to do that in code, any ideas?

  2. #2
    Hyperactive Member
    Join Date
    Sep 1999


    here's an answer, compliments of Yonatan:

    Try this:
    First, put the following code in a module.

    Option Explicit

    Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long
    Public Const EWX_LOGOFF = 0
    Public Const EWX_SHUTDOWN = 1
    Public Const EWX_REBOOT = 2
    Public Const EWX_FORCE = 4
    Public Const EWX_POWEROFF = 8 ' Yes, I know this one's not in the API Viewer

    Then from anywhere, use this:

    To shut down:
    Call ExitWindowsEx(EWX_FORCE Or EWX_SHUTDOWN, 0)

    To reboot:
    Call ExitWindowsEx(EWX_FORCE Or EWX_REBOOT, 0)

    To log off the current user: (This works for WinNT, the others don't)
    Call ExitWindowsEx(EWX_FORCE Or EWX_LOGOFF, 0)

    To shut down and turn off the computer: (Only supported under Windows 98 under some motherboards)
    Call ExitWindowsEx(EWX_FORCE Or EWX_POWEROFF, 0)

    Note: If you use EWX_POWEROFF in a computer that doesn't support auto-turnoff, then it should be the same as EWX_SHUTDOWN.

  3. #3
    Guru Clunietp's Avatar
    Join Date
    Oct 1999


    For WinNT, you can also use


    I'm assuming by the name that if the O/S or a process hangs at shutdown, it will be terminated after a timeout period expires...

  4. #4


    Thanks for the code and all. But, what I want to do is do a soft reboot....ONLY restart windows, not reboot the computer entirely. You know, when you install some programs, they claim that you need to "restart windows before the changes will take effect," and when you say "OK," it goes to a black screen saying "Windows is restarting..." That's what I want Any ideas?


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