|
-
Jan 11th, 2002, 03:29 PM
#1
Thread Starter
Addicted Member
Shutting down windows
Hi,
IO'm trying to shutdown Windows. I use these:
Declare Function ExitWindowsEx Lib "user32" _
(ByVal uFlags As Long, _
ByVal dwReserved As Long) As Long
Public Const EWX_FORCE = 4
Public Const EWX_LOGOFF = 0
Public Const EWX_REBOOT = 2
Public Const EWX_SHUTDOWN = 1
x = ExitWindowsEx(EWX_SHUTDOWN, 0)
But when I use EWX_FORCE then I just logsoff(2000). When Shutdown is called nothing happens. What am I doing wrong?
Sand Hawk
- We wish to assimilate more information.
-
Jan 11th, 2002, 03:39 PM
#2
Use them together
VB Code:
ExitWindowsEx (EWX_SHUTDOWN + EWX_FORCE)
-
Jan 11th, 2002, 04:21 PM
#3
Thread Starter
Addicted Member
It still doesn't work. I use this code to shutdown windows:
Code:
If lTime >= lShutdownTime Then
Unload frmNotify
Shutdown.Interval = 0
lResult = ExitWindowsEx(EWX_SHUTDOWN Or EWX_FORCE, 0)
End If
I tried "OR", "+" and "&". All don't work. What's wrong? I use VB 6 Enterprise with Service Pack 5 and running Windows 2000 with Service Pack 1(Too lazy to install 2). Anyone?
Sand Hawk
- We wish to assimilate more information.
-
Jan 11th, 2002, 05:41 PM
#4
The 0 you pass as the last argument is the constant of EWX_LOGOFF. Try switching that 0 to 1, or 4, and remove the +'s and Ands and Or's and the EWX_FORCE so your code would look like this:
VB Code:
x = ExitWindowsEx(EWX_SHUTDOWN, 1)
'Or if that doesn't work,
x = ExitWindowsEx(EWX_SHUTDOWN, 4)
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
|