Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today

Thread Tools Search this Thread Display Modes
Old 10-16-2006, 06:17 PM   #1
Baseband Member
Join Date: Oct 2005
Posts: 53
Default working with win. API: Shutting down

ok i'm just learning C++ and am trying to figure out how to shutdown a windows machine using API calls.

#include <windows.h>

int main(){
using namespace std;

BOOL WINAPI ExitWindowsEx(

return 0;
on line 11 I am getting the compiler error on line 11

expected `,' or `...' before numeric constant

I've looked at it for a while and quite frankly I'm confused. What little knowledge I have on the subject has come from microsoft msdn.

band-aid is offline   Reply With Quote
Old 10-17-2006, 02:43 PM   #2
Baseband Member
Griz803's Avatar
Join Date: Jun 2004
Posts: 89
Default Re: working with win. API: Shutting down

Hmmm.... my documentation shows that there should be a different constant for it. Check out the code snippet below and see if that helps or hurts you.
And for good measure, you'd probably better convert the int main() thing into the more appropriate Winmain structure, too.


// My docs say that it isn't EWX_FORCEIFHUNG, just EWX_FORCE.
// And IMHO, it never hurts to group ops within a prototype call.  
// So I'd add some parentheses to the parameters to be OR'ed.
BOOL WINAPI ExitWindowsEx(
I hope this will help you out. Try it and see, but it could do you no good either. Constants in headers rarely change, but when they do they can have nasty effects, so proceed with all due caution!

You might just want to schlep on over to http://www.winprog.org/tutorial/ and read up on Win32 basics from the ground up. I hope some of this helps get you on your way.
/*What does not kill us, makes us drink far too much caffeine*/
Griz803 is offline   Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

All times are GMT -5. The time now is 07:46 PM.

Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0