Discussion:
How run the programm before system shutdown?
(too old to reply)
Alex Klash
2003-08-20 05:45:31 UTC
Permalink
I need run progamm after user has begun initialize system shutdown and
before system is starting shuwdown process. Can anybody help me, how do it?
OS - Windows 2000 or XP.
Please ansver me to e-mail, if it's posible.

Thank's.
Alex Klash
2003-08-20 10:32:49 UTC
Permalink
Hi Sreeram!

O Yes! Thank's!

I mast write like this?

...
case WM_QUERYENDSESSION:
CreateThread ( ......SomeShutDownProc....);
retrun FALSE;
....

SomeShutDownProc(){
........
ExitWindows();

};
Hi Alex,
You can handle WM_QUERYENDSESSION which will fire when the system is
shutting down. Are you looking for this information?
Sreeram
Post by Alex Klash
I need run progamm after user has begun initialize system shutdown and
before system is starting shuwdown process. Can anybody help me, how do it?
OS - Windows 2000 or XP.
Please ansver me to e-mail, if it's posible.
Thank's.
Sreeram
2003-08-20 10:47:38 UTC
Permalink
Hi Alex,

You can write code in OnQueryEndSession fn. which is the message map for
WM_QUERYENDSESSION. This message will fire when the windows is
shutting down or logg of. You don't have to call ExitWindows again.

Sreeram
Post by Alex Klash
Hi Sreeram!
O Yes! Thank's!
I mast write like this?
...
CreateThread ( ......SomeShutDownProc....);
retrun FALSE;
....
SomeShutDownProc(){
........
ExitWindows();
};
Hi Alex,
You can handle WM_QUERYENDSESSION which will fire when the system is
shutting down. Are you looking for this information?
Sreeram
Post by Alex Klash
I need run progamm after user has begun initialize system shutdown and
before system is starting shuwdown process. Can anybody help me, how do
it?
Post by Alex Klash
OS - Windows 2000 or XP.
Please ansver me to e-mail, if it's posible.
Thank's.
Alex Klash
2003-08-20 14:23:33 UTC
Permalink
Hi Sreeram!

I can write code that may take long execution times. In this case OSwindows
may show window "Programm not responding" and this is bad. What can I do in
this case?

Thank's
Hi Alex,
You can write code in OnQueryEndSession fn. which is the message map for
WM_QUERYENDSESSION. This message will fire when the windows is
shutting down or logg of. You don't have to call ExitWindows again.
Sreeram
Post by Alex Klash
Hi Sreeram!
O Yes! Thank's!
I mast write like this?
...
CreateThread ( ......SomeShutDownProc....);
retrun FALSE;
....
SomeShutDownProc(){
........
ExitWindows();
};
Hi Alex,
You can handle WM_QUERYENDSESSION which will fire when the system is
shutting down. Are you looking for this information?
Sreeram
Post by Alex Klash
I need run progamm after user has begun initialize system shutdown and
before system is starting shuwdown process. Can anybody help me, how do
it?
Post by Alex Klash
OS - Windows 2000 or XP.
Please ansver me to e-mail, if it's posible.
Thank's.
Gary Chanson
2003-08-20 18:29:27 UTC
Permalink
Post by Alex Klash
Hi Sreeram!
I can write code that may take long execution times. In this case OSwindows
may show window "Programm not responding" and this is bad. What can I do in
this case?
All you can do is refuse the shutdown, process your function, and the
restart the shutdown process. This, by the way, introduces a problem with
knowing exactly what type of shutdown was in progress.
--
-GJC
-Software Consultant (Embedded systems and Real Time Controls)
-***@mvps.org

-Abolish public schools
Robot
2008-07-27 11:04:07 UTC
Permalink
Post by Alex Klash
Hi Sreeram!
I can write code that may take long execution times. In this case OSwindows
may show window "Programm not responding" and this is bad. What can I do in
this case?
Thank's
Hi Alex,
You can write code in OnQueryEndSession fn. which is the message map for
WM_QUERYENDSESSION. This message will fire when the windows is
shutting down or logg of. You don't have to call ExitWindows again.
Sreeram
Post by Alex Klash
Hi Sreeram!
O Yes! Thank's!
I mast write like this?
...
CreateThread ( ......SomeShutDownProc....);
retrun FALSE;
....
SomeShutDownProc(){
........
ExitWindows();
};
Hi Alex,
You can handle WM_QUERYENDSESSION which will fire when the system is
shutting down. Are you looking for this information?
Sreeram
Post by Alex Klash
I need run progamm after user has begun initialize system shutdown and
before system is starting shuwdown process. Can anybody help me, how do
it?
Post by Alex Klash
OS - Windows 2000 or XP.
Please ansver me to e-mail, if it's posible.
Thank's.
Let your main thread process windows messages, and create another thread
for your long-running-function.

Also TOP-POSTING IS BAD in the news group communities!
--
BTW, I use WebMailSelector because I have many email addresses.
I recommend it. It is available at http://www.mselector.com
Loading...