|
-
May 22nd, 2001, 03:47 AM
#1
Thread Starter
Addicted Member
Exiting Windows
Hi there,
I wnat to know if i can close the Windows OS itself from my Program. I mean to say that if my program is closed/exited. the system should shutdown automatically.
I've tried using ExitWindowsEx as below;
Dim i As Boolean
i = ExitWindowsEx(EWX_SHUTDOWN + EWX_FORCE, 0)
but it only logsoff the cureent user. it is not shutting down the system. Any help is welkome.
Thnx in adv.
Cute Member 
-
May 22nd, 2001, 04:00 AM
#2
Addicted Member
Hi there,
with ExitWindowsEx() api
try different combinations of parameters.
Yes, I did get ur result with 1,1 in the parenthesis,
try out exitwindowsex(1,10). It should shut down windows.
Reply if u have got the solution.
Cheers,
Ven.
-
May 22nd, 2001, 05:38 AM
#3
Frenzied Member
Code:
'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()
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
-
May 23rd, 2001, 12:41 AM
#4
Thread Starter
Addicted Member
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
|