Is Windows Shutting Down?

Posted on 1998-10-07
Medium Priority
Last Modified: 2010-04-06
Can I get my Delphi program to detect if Windows is about to shut down?
Question by:zammo
1 Comment

Accepted Solution

inter earned 0 total points
ID: 1342149
you should handle the following message to your form
  TForm1 = class(TForm)
    procedure EndSMsg(var T : TMessage);message  WM_QUERYENDSESSION;
procedure TFOrm1.EndSMsg(var T : TMessage);
  // return false if you want to cancel logoff or shutdown
  T.result := true;
  if T.lparam <> ENDSESSION_LOGOFF then
     //shutting down
  end else
     //login off

regards, igor

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
The video will let you know the exact process to import OST/PST files to the cloud based Office 365 mailboxes. Using Kernel Import PST to Office 365 tool, one can quickly import numerous OST/PST files to Office 365. Besides this, the tool also comes…
Suggested Courses

589 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question