Is Windows Shutting Down?

Posted on 1998-10-07
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

947 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now