|
-
Feb 28th, 2002, 10:04 PM
#1
Thread Starter
PowerPoster
Shutdown Windows...
How can I initiate Windows Shutdown in C++??
-----------------------------------------
-RJ
[email protected]
-----------------------------------------
-
Feb 28th, 2002, 11:03 PM
#2
Member
Hello
Hey,
I am just now going back to C++, I used it a long time ago for a multimedia presentation, but for the past few years have used VB for everything, I made a daemon (Ok it is realy a trojan). That would reboot a computer when you connected to port 20. (Good for when my little bro was kicking my butt in a strategy game.) And I used the following VB code. If you include winuser.h, you should be able to call the ExitWindowsEx function. You may have to do something else with NT / 2000 I don't know. Anyways, the following VB code was copied from. vb world.
http://www.vb-world.net/tips/tip12.html
Public Const EWX_LOGOFF = 0
Public Const EWX_SHUTDOWN = 1
Public Const EWX_REBOOT = 2
Public Const EWX_FORCE = 4
Declare Function ExitWindowsEx Lib "user32" Alias _
"ExitWindowsEx" (ByVal uFlags As Long, ByVal dwReserved _
As Long) As Long
If you wanted to forcefully reboot the computer use the following code:
t& = ExitWindowsEx(EWX_FORCE Or EWX_REBOOT, 0)
I hope that helps some,
Joey
You have no idea how many idiots there are among us.
Winsock is awesome!
If you are reading this, your a geek, just face it.
-
Feb 28th, 2002, 11:26 PM
#3
Thread Starter
PowerPoster
Cheers, dude. My prob was not knowing which lib to include.
Ta.
-----------------------------------------
-RJ
[email protected]
-----------------------------------------
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
|