-
HI,
I am writing an application for logging staff PC activities. Part of the login process is a screen requiring for a password, if the result is returned negative (Wrong) i want the computer after 3 false tries to restart windows.
I know there is a way of cammanding a Dll with a switch to restart windows unprompted.
Does anyone know what the name of that Dll is and what the code to run it is?
Any help would be appreciated.
Regards
Morpheus
(VB6 Pro Edition)
-
Got this code from vb-square.
Code:
'Api function and the constants required for ExitWindowsEx
Declare Function ExitWindowsEx& Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long)
Public Const EWX_FORCE = 4
Public Const EWX_LOGOFF = 0
Public Const EWX_REBOOT = 2
Public Const EWX_SHUTDOWN = 1
Private Sub cmdShutdown_Click()
Dim MsgRes As Long
'Make sure that the user really want to shutdown
MsgRes = MsgBox("Are you sure you want to Shut Down Windows 95?", vbYesNo Or vbQuestion)
'If the user selects no, exit this sub
If MsgRes = vbNo Then Exit Sub
'else, shutdown windows and unload this form
Call ExitWindowsEx(EWX_SHUTDOWN, 0)
Unload Me
End Sub
But for it to work the way you want to I suggest modifying it to this:
Code:
'Api function and the constants required for ExitWindowsEx
Declare Function ExitWindowsEx& Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long)
Public Const EWX_FORCE = 4
Public Const EWX_LOGOFF = 0
Public Const EWX_REBOOT = 2
Public Const EWX_SHUTDOWN = 1
'Call reboot without any prompting when they have tried 3 times and failed
Call ExitWindowsEx(EWX_REBOOT, 0)
Unload Me
Hope this helps!!!