Results 1 to 7 of 7

Thread: Reboot command???

  1. #1

    Thread Starter
    Hyperactive Member mikef's Avatar
    Join Date
    Jun 2000
    Location
    Beach bound...
    Posts
    510

    Question

    Anyone know of an easy way to re-boot windows after an installation process. I want to do the usual......Settings have changed and you will need to re-start your computer for them to take effect. Do you wish to reboot now??

    YES NO

    when they hit yes....re-start windows automatically.

    I thought there was an API but maybe something better???

    Thanks for any suggestions.
    "If I had known it was going to be that kinda party, I would have stuck my disk in the mash potatos!"

  2. #2
    Addicted Member Geoff Gunson's Avatar
    Join Date
    Jun 1999
    Posts
    241
    Here's a tip from this very site.

    Copy the following code into the declarations section of a module:

    Public Const EWX_LOGOFF = 0
    Public Const EWX_SHUTDOWN = 1
    Public Const EWX_REBOOT = 2
    Public Const EWX_FORCE = 4
    Declare Function ExitWindowsEx Lib "user32" Alias _
    "ExitWindowsEx" (ByVal uFlags As Long, ByVal dwReserved _
    As Long) As Long
    If you wanted to forcefully reboot the computer use the following code:

    t& = ExitWindowsEx(EWX_FORCE Or EWX_REBOOT, 0)

    HTH

    G

  3. #3

    Thread Starter
    Hyperactive Member mikef's Avatar
    Join Date
    Jun 2000
    Location
    Beach bound...
    Posts
    510

    Smile

    Thanks....that is perfect. Just what I was looking for!

    Thanks for the help!

    .....later
    "If I had known it was going to be that kinda party, I would have stuck my disk in the mash potatos!"

  4. #4
    Guest
    If you want a dialog box, this code shows the "System Settings Change" message box ("You must restart your computer before the new settings will take effect.")


    Code:
    Private Const EWX_FORCE = 4
    
    Private Declare Function SHRestartSystemMB _
    Lib "shell32" Alias "#59" (ByVal hOwner As Long, ByVal _
    sExtraPrompt As String, ByVal uFlags As Long) As Long
    
    
    Private Sub Command1_Click()
        SHRestartSystemMB Me.hwnd, vbNullString, EWX_FORCE
    End Sub

  5. #5
    Lively Member
    Join Date
    Sep 2000
    Location
    NC, USA
    Posts
    102
    One note, just incase anyone is using NT, there is a little more involved. If anyone needs it I will post it. I would do it now but I dont have the code here with me.

  6. #6

    Thread Starter
    Hyperactive Member mikef's Avatar
    Join Date
    Jun 2000
    Location
    Beach bound...
    Posts
    510
    No. My app is only for win98 and me.

    anything special with those??
    "If I had known it was going to be that kinda party, I would have stuck my disk in the mash potatos!"

  7. #7

    Thread Starter
    Hyperactive Member mikef's Avatar
    Join Date
    Jun 2000
    Location
    Beach bound...
    Posts
    510
    Anyone know where to insert this code in the setup1 source code for the Setup Wizard in VB 5.

    The forms and such seem weird to me and I can't find the location??
    "If I had known it was going to be that kinda party, I would have stuck my disk in the mash potatos!"

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