John Thomas
John Thomas

Reputation: 4135

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:

Any ideas how to fix it?

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

Upvotes: 3

Views: 391

Answers (3)

Lieven Keersmaekers
Lieven Keersmaekers

Reputation: 58431

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.

Upvotes: 1

madshiva
madshiva

Reputation: 31

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

Upvotes: 0

GSerg
GSerg

Reputation: 78155

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

Upvotes: 1

Related Questions