|
-
Nov 17th, 2001, 03:42 AM
#1
Thread Starter
New Member
Windows Shutdown API
I am new to this and trying to learn. I am having trouble using the Windows Shutdown API. When I try to declare the function in my code it states the the constants can't be public?
Here is the code, where should I declare this function and how do I go about doing so...'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
Thanks a bunch!!
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
|