• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 344
  • Last Modified:

Indy IDHTTPServer and Windows shutdown

Hello!

I have an application using the Indy hTTP server and when I shutdown or logoff Windows while the application is still running, the application generate a bunch or error message before crashing...  
However, the application termianate fine if close manually...

I do De-Activate the server on Application close and Application Destroy... but still...

Is there a proper way to terminate the application/server when Windows is shuttong down?
0
PaulP
Asked:
PaulP
  • 2
1 Solution
 
geobulCommented:
Hi,

Try to catch that message and de-activate your server there (in the main form only):

type
  TForm1 = class(TForm)
  private
    { Private declarations }
    procedure QueryEndSession( var Msg: TWMQUERYENDSESSION); message WM_QUERYENDSESSION;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.QueryEndSession( var Msg: TWMQUERYENDSESSION);
begin
  // add your code here
  // ...
  Msg.Result := 1; // can't remember exactly if it should return zero or non-zero (non-zero most probably)
end;

Regards, Geo
0
 
geobulCommented:
The result should be non-zero for sure.

Regards, Geo
0
 
PaulPAuthor Commented:
Thanks Geo!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now