|
-
April 15th, 1999, 10:57 AM
#1
How could I shutdown a computer in my VC++ program?
I want my program could shutdown computer, I know how to suspend it, but How can I shutdown it?
Thanks.
-
April 15th, 1999, 11:04 AM
#2
Re: How could I shutdown a computer in my VC++ program?
ExitWindowsEx ( EXW_SHUTDOWN, 0 );
will start a shutdown but will prompt the user whether to close any active applications - this gives the user the chance to cancel the shutdown.
ExitWindowsEx ( EXW_SHUTDOWN|EXW_FORCE, 0 );
does a shutdown, killing any active applications.
-
April 15th, 1999, 11:56 AM
#3
Re: How could I shutdown a computer in my VC++ program?
There is an additional snag if you're running on Windows NT. You have to set up the application's process token with permissions to allow you to shut down the PC.
The functions you'll need to look at are:
OpenProcessToken()
GetTokenInformation()
LookupPrivilegeValue()
AdjustTokenPrivileges()
If you're running on Windows 95/98, you don't have to worry about this.
Good luck!
Valerie Bradley
http://www.synthcom.com/~val
[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
|