How to detect Windows shutting down
-
I have a C program, using Visual C++6 development environment, running under Windows 98. I want to write some finalisation information and close a logging file when the program closes. To do this, I watch for WM_QUIT in the message loop in WinMain(), and when this arrives, I write to the file and close it This works fine when I shut down my program "normally" (click on "close" button or File / Exit), but when my program is running, and the user shuts down Windows, I do not detect this, so the finalisation info is not written. How can I detect Windows shutting down? (as I said, preferably at the SDK level.)
-
I have a C program, using Visual C++6 development environment, running under Windows 98. I want to write some finalisation information and close a logging file when the program closes. To do this, I watch for WM_QUIT in the message loop in WinMain(), and when this arrives, I write to the file and close it This works fine when I shut down my program "normally" (click on "close" button or File / Exit), but when my program is running, and the user shuts down Windows, I do not detect this, so the finalisation info is not written. How can I detect Windows shutting down? (as I said, preferably at the SDK level.)
catch
WM_ENDSESSION
in Single USer based OS ie 95/98/ME catchWM_QUERYENDSESSION
in Multi user based OS ie 2000 and above. this Message is Send by Window OS when it is shuting down ----------------------------- "I Think this Will Help" ----------------------------- Alok Gupta visit me at http://www.thisisalok.tk -
catch
WM_ENDSESSION
in Single USer based OS ie 95/98/ME catchWM_QUERYENDSESSION
in Multi user based OS ie 2000 and above. this Message is Send by Window OS when it is shuting down ----------------------------- "I Think this Will Help" ----------------------------- Alok Gupta visit me at http://www.thisisalok.tk