|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Shut DownIn windows XP Pro and VB6. I have a VB6 executable that automatically runs
every day several hours after I leave work. I want to add some code that will shut down the computer at the end of the process. How can I do this? Thanks -- Shell ' SHUT DOWN AND RESTART IN VB6
Const EWX_LogOff As Long = 0 Const EWX_SHUTDOWN As Long = 1 Const EWX_REBOOT As Long = 2 Const EWX_FORCE As Long = 4 Private Declare Function ExitWindows _ Lib "User32" Alias "ExitWindowsEx" _ (ByVal dwOptions As Long, ByVal dwReserved As Long) As Long Private Sub Command1_Click() 'Shut down windows ExitWindows EWX_SHUTDOWN, &HFFFFFFFF End Sub Private Sub Command2_Click() 'Reboot ExitWindows EWX_REBOOT, &HFFFFFFFF End Sub Show quoteHide quote "Shell" <Sh***@discussions.microsoft.com> wrote in message news:997F47E2-0DA2-4E11-8DC5-F0A7C823BF2E@microsoft.com... > In windows XP Pro and VB6. I have a VB6 executable that automatically > runs > every day several hours after I leave work. I want to add some code that > will shut down the computer at the end of the process. > > How can I do this? > > Thanks > -- > Shell
Show quote
Hide quote
"Daryl Muellenberg" <dmuellenb***@comcast.net> wrote in message news:%23T4EdAVrJHA.5916@TK2MSFTNGP02.phx.gbl... That most likely will not work. The app must have the shutdown privilege.>' SHUT DOWN AND RESTART IN VB6 > Const EWX_LogOff As Long = 0 > Const EWX_SHUTDOWN As Long = 1 > Const EWX_REBOOT As Long = 2 > Const EWX_FORCE As Long = 4 > Private Declare Function ExitWindows _ > Lib "User32" Alias "ExitWindowsEx" _ > (ByVal dwOptions As Long, ByVal dwReserved As Long) As Long > > Private Sub Command1_Click() > > 'Shut down windows > ExitWindows EWX_SHUTDOWN, &HFFFFFFFF > > End Sub > > Private Sub Command2_Click() > > 'Reboot > ExitWindows EWX_REBOOT, &HFFFFFFFF > > End Sub > > PRB: ExitWindowsEx API Does Not Reboot Windows NT http://support.microsoft.com/kb/176695 -- Mike
Beep Again
URLDownloadToFile API failing due to disclaimer page Beep Beep RichTextBox Input OT: Can cause VB6 an error of this kind? Subscript out of range VB 6 on loading a form SQL Server Compact Edition with VB6 VB6 IDE Find doesn't Simple timer uses more and more memory Name of a Callback function |
|||||||||||||||||||||||