Solved

Is Windows Shutting Down?

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

Accepted Solution

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

regards, igor
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

757 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

17 Experts available now in Live!

Get 1:1 Help Now