Reputation: 9
Since Windows 7 it is possible to close my application via Tasklist -> close even when a modal dialog is on the screen. In earlier Versions of Windows the "close" button in the task line of the desktop is disabled as are all parent windows of the dialog in my application. In Win7 (and above) the parent windows of the dialog are still disabled, but not the close() item in the taskbar. Such a scenario (close of while while modal dialog is on the screen) yields a crash of my application. (Note: we are talking about >>100 dialogs, and >>100 .exe files. ) i am even happy with a completly removing this close item in the taskbar.
Any ideas?
Upvotes: 0
Views: 202
Reputation: 308091
Closing an application is signaled with the WM_SYSCOMMAND
message with a parameter of SC_CLOSE
. If you put in a message handler you can intercept the request and do whatever you want.
Be aware of two things: applications that don't close when you want them to are very frustrating for a user, and it's always possible to force-close an application via the Task Manager.
Upvotes: 2