I’ve just had an awful bug search on a machine of a fellow programmer. He wanted to use the PNGComponents in Delphi2007 and just installed it as usual. (He’s running Vista SP1 by the way.) After a successul installation he tried to put a TPngImageList on the form. In the same moment the whole Delphi IDE froze and then was closed by Windows forcefully. He demonstrated it several times to me and I could not understand why this happened.

So I hooked up WinDbg to get more information. But even the exception and call stack of WinDbg were not sufficient (to me) because the exception location just contained the class name and some numbers. I blamed the property editor which shows the PNG images in a list. So I removed the whole code and it worked without the editor – a not so good ending.
A long time later, I was frustrated and thought about giving up. In a final effort I run another test. You should know that while I was trying to bust the bug, WinDbg watched the process in the background – to catch exceptions. In my last test, however, it did not! And there I saw it: It was the first time that I could see a balloon pop up from the taskbar notification area (next to the clock). It told me that the application was closed due to DEP : Data Execution Prevention.

I know that this notification should pop up every time : but it did not! I confirm on oath! Recall: The first demonstrations were made without WinDbg! On my PC DEP is turned off because many applications wouldn’t work and even some games would be closed randomly in the middle of the game .

In the end it helped to add Delphi to the exception list or to turn off DEP completely(*). Decide yourself which way you choose. In the good ending I hope you remember this article next time you run into such a problem.

(*) Services cannot be removed from DEP protection.

Update:

If you have installed a specific Logitech (Quick)WebCam Driver, the DEP also strikes back if you try to run your app on newer Delphi (tested on D2007 and D2009).
Marco Cantu had this experience a while ago and we experienced it again.