Indy IDHTTPServer and Windows shutdown

Posted on 2005-03-12
Medium Priority
Last Modified: 2010-04-04

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?
Question by:PaulP
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 17

Accepted Solution

geobul earned 500 total points
ID: 13524838

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

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

  Form1: TForm1;


{$R *.DFM}

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

Regards, Geo
LVL 17

Expert Comment

ID: 13524843
The result should be non-zero for sure.

Regards, Geo

Author Comment

ID: 13527461
Thanks Geo!

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month13 days, 6 hours left to enroll

777 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