|
-
Feb 15th, 2001, 10:50 AM
#1
Thread Starter
Hyperactive Member
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!"
-
Feb 15th, 2001, 11:04 AM
#2
Addicted Member
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
-
Feb 15th, 2001, 11:31 AM
#3
Thread Starter
Hyperactive Member
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!"
-
Feb 15th, 2001, 03:10 PM
#4
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
-
Feb 15th, 2001, 04:05 PM
#5
Lively Member
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.
-
Feb 15th, 2001, 05:31 PM
#6
Thread Starter
Hyperactive Member
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!"
-
Feb 15th, 2001, 05:33 PM
#7
Thread Starter
Hyperactive Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|