Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ExitWindowsEx Function in user32.dll

Status
Not open for further replies.

Clarkster

MIS
Jun 19, 2000
18
US
I can't seem to get the ExitWindowsEx function to work according to specification. No matter what parameter I pass, all I get is a logoff. I don't quite understand the difference between passing by value or by reference. Here is my code;

Declare long ExitWindowsEx in user32 long uFlags, long dwReserved

ExitWindowsEx(4,0)

Since the parameter 0=EWX_LOGOFF, It seems that the parameter uFlags always evaluates to 0 for some reason, but I don't know how to test that hypothesis. [sig][/sig]
 
Hi Clarkster

0 = EWX_LOGOFF;
8 = EWX_POWEROFF;
2 = EWX_REBOOT;
1 = EWX_SHUTDOWN;
4 = EWX_FORCE;
5 = EWX_SHUTDOWN | EWX_FORCE; ' or

If you want to force shutdown, first param = 5. Second param is reserved (no use)

Hope it helps

Jimmy K
[sig][/sig]
 
The problem is that regardless of the number used, the function still interprets it as 0. Why?
 
Hi, Clarkster!

I looked to Win32API help file and figured out that you declared function incorrectly, should be:

Declare integer ExitWindowsEx in user32 integer uFlags, integer dwReserved



Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
Hi Clark,
Maybe, the problem is your Windows, not VFP. Please check it out.

..and, your declaration is correct.

Jimmy K
 
Thanks for the responses. Using the value 5 or 9 does initiate a shutdown but Windows hangs on the "shutting down" splash screen. I have this sinking feeling that the windows shutdown accessible from the start button uses a different routine than the user32 library function (using version 4.10.2227 dated 4/21/2000). I seem to recall Microsoft patching a problem with shutdown hanging when drives were mapped. Maybe their patch was to abandon the user32 shutdown function.

Any thoughts on how to test this?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top