English 中文(简体)
The OS doesn t shutdown, but my application does
原标题:

I have an application which when I close the Windows, it exits gracefully and quickly (checked also in Task Manager and Process Explorer - the process isn t there anymore) but the OS doesn t. It seems that OS just ignores the Shutdown.

But if I try to close once more the Windows, now everything is ok. The system shuts down in a very normal way.

  1. Why?
  2. How can I fix this?

Details about my app:

  • multithreaded
  • has a tray icon
  • doesn t do any special processing of WM_QUERYENDSESSION (or similar) OS messages
  • doesn t have any special driver, DLL hook etc.

Any ideas how to fix it?

PS: I m at your disposition with and further details upon request

问题回答

Do you indeed return TRUE to the WM_QUERYENDSESSION (or similar) OS messages? You might get the message, close the app and return FALSE.

Strange but almost exactly the same problem bugged us this week.

The application ran in the tray, closed but prevented windows from shutting down. So having been there, I ll share what fixed the problem for us.

  • Removing a datamodule fixed the problem.
  • Removing the NMsmtp component fixed the problem.
  • Implementing the suggestion given in this bug report fixed the problem on my workstation, but not on another.

In the end, we choose to just remove the NMsmtp component for wich we didn t have the source code and changed to using Indy.

Most likely, your situation will differ therefore I d suggest you do like we did and start stripping everything from you project until it works.

If the application still doing work on the background this could be prevent Windows to shutdown.

You could check if the AutoEndTasks settings are enabled and enabled it if not :

http://technet.microsoft.com/en-us/library/cc978604.aspx

Best Regards





相关问题
determining the character set to use

my delphi 2009 app has a basic translation system that uses GNUGetText. i had used some win API calls to prepare the fonts. i thought it was working correctly until recently when someone from Malta ...

Help with strange Delphi 5 IDE problems

Ok, I m going nuts here. For the last (almost) four years, I ve been putting up with some extremely bad behavior from my Delphi 5 IDE. Problems include: Seemingly random errors in coride50.bpl ...

How to write a Remote DataModule to run on a linux server?

i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...

How convert string to integer in Oxygene

In Delphi, there is a function StrToInt() that converts a string to an integer value; there is also IntToStr(), which does the reverse. These functions doesn t appear to be part of Oxygene, and I can ...

Quick padding of a string in Delphi

I was trying to speed up a certain routine in an application, and my profiler, AQTime, identified one method in particular as a bottleneck. The method has been with us for years, and is part of a "...

热门标签