Performing a task when shutdown or logoff is called

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: lallous (lallous_at_lgwm.org)
Date: 01/12/05


Date: Wed, 12 Jan 2005 16:58:21 +0200

Hello

I have create a simply hidden window that listens for WM_QUERYENDSESSION.

When that message occurs, I simply start the task and block the call till
the task is finished.
Once the task is finished, the system is allowed to continue the shutdown
process.

However, if the task tasks more time than usual, the "End now" dialog is
appearing and wanting to close my application.

How can I perform any task (no matter how long) on before shutdown and when
the task is over, the system should resume shutdown ?

I can think of a solution as:
1.when query end session is captured, simply tell the system to cancel
shutdown
2.carry the task
3.re-issue shutdown myself

However, I might not have enough privilege to logoff/restart/shutdown the
system at step3.

--
Elias 


Relevant Pages

  • Re: detect shutdown of other application
    ... my little application should also shutdown... ... > so, is there a way, that my application 'listens' when the other application ... shuts the rest of the applicaiton down when that call returns. ... If replying to the group, please do not mail me too ...
    (microsoft.public.dotnet.framework)
  • Re: Performing a task when shutdown or logoff is called
    ... > I have create a simply hidden window that listens for ... > How can I perform any task on before shutdown ...
    (microsoft.public.vc.language)
  • RE: Audit Privilege Use - Windows 2003 Security Guide
    ... Changing the system time does result in a success event for the user who ... you provided using the shutdown command). ... It would appear that the auditing for privilege use is not very reliable ... Here is a sample Failure Audit event when a user without system shutdown ...
    (microsoft.public.security)
  • RE: Audit Privilege Use - Windows 2003 Security Guide
    ... tried your suggestion of attempting a reboot using shutdown -r, ... Changing the system time does result in a success event for the user who ... It would appear that the auditing for privilege use is not very reliable ... Here is a sample Failure Audit event when a user without system shutdown ...
    (microsoft.public.security)
  • Re: Restart/shutdown not available
    ... THis happens when the user account does not have privilege to shutdown the ... machine ("Shut down the system" under User Rights Assignment in the local ... security policy). ...
    (microsoft.public.win2000.security)