how can i Shutdown windows with api please help me
Printable View
how can i Shutdown windows with api please help me
Take a look at this thread.
Code:Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long
Private Const EWX_POWEROFF = &H8
Private Const EWX_FORCE = 4
Private Sub Command1_Click()
ExitWindowsEx EWX_POWEROFF Or EWX_FORCE, 0
End Sub
This is the command the shut down box gives your computer:
[code]
shell(Rundll32.exe KRNL386.EXE,ExitKernel)
[\code]
it's not api but it is short and doesn't cause a improper shutdown(no scandisk)
and it doesn't prompt you to close anything it just shuts down.
private declare function ExitWindowsEx Lib "user32" _
(byval dwFlags As Long,byval dwReserved As Long) _
As Long
To Shut Down, Pass 0 To dwFlags
This Function If Not Successful Returns A Numeric Code In Case Any App Cancelled The ShutDown.
Eg:
ExitWindowsEx 0,0