April 28th, 1999, 08:21 AM
Can somebody explain me how use ExitWindowsEx() function ?
Because i can't use it. When i use it produce an exception
when my application finished.
I used Visual C++ 6.0 under Windows 95.
If somebody can help me or give me a site where i may find
explication about this function i be very happy :-)
Marc Howe
April 28th, 1999, 10:33 AM
Here are some examples:
This will log the current user off of the current session of windows: ExitWindowsEx(EWX_LOGOFF,0);
This will reboot the computer without "forcing": ExitWindowsEx (EWX_REBOOT ,0);
This will force the reboot:
ExitWindowsEx(EWX_REBOOT|EWX_FORCE,0L);
Hope this helps...
You can look in the MSDN for ExitWindowsEx and it shows you the flags you can use and what they mean. Make sure you use "Entire Collection" when looking this up so that you can get the most responses to your query...
Good luck,
Marc
P.S. Remember to call OnOK() after calling this function, because your program will not automatically close simply because you decide to logoff. Most calls to ExitWindowsEx should have the OnOK() func called after it...we should always decide when our programs close, not the OS.