Mike,<p>Here are the API function for what you requested.<p>'In general section
Const EWX_LOGOFF = 0
Const EWX_SHUTDOWN = 1
Const EWX_REBOOT = 2
Const EWX_FORCE = 4
Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long
Private Sub Form_Load()
'KPD-Team 1998
'URL:
http://www.allapi.net/
'E-Mail:
[email protected]
msg = MsgBox("This program is going to reboot your computer. Press OK to continue or Cancel to stop.", vbCritical + vbOKCancel + 256, App.Title)
If msg = vbCancel Then End
'reboot the computer
ret& = ExitWindowsEx(EWX_FORCE Or EWX_REBOOT, 0)
End Sub<p>Or try this:<p>For Windows 9x use this:<p>SHUTDOWN BUTTON<p>Private Sub Command1_Click()
Shell "Rundll32.exe user,exitwindows"
End Sub<p>RESTART BUTTON<p>Private Sub Command2_Click()
Shell "rundll32.exe shell32.dll,SHExitWindowsEx 2"
End Sub<p>
For Windows 2000 and XP, I recommend you download a better alternative to the shutdown.exe used in XP.
You can do a search for it or download it from the Wintips file section if you are a member
http://groups.yahoo.com/group/WinTips-Tricks/files/
Look for shutdown2.exe
then place it in your System folder and use this code:<p>SHUTDOWN BUTTON<p>Private Sub Command1_Click()
Shell "shutdown2.exe -u -t 0"
End Sub<p>RESTART BUTTON<p>Private Sub Command2_Click()
Shell "shutdown2.exe -r -t 0"
End Sub<p>
Greg