Quote from tfjield:
I don't use this method anymore, but I did experiment with it for a while. How do you guys unhook from the main window when you want to close the app?
The problem is if you just click close on the app, the message gets processed by the main window with your hook as part of the call chain.
I tried unhooking on the close message, then sending it again, but if the user then pressed No on the "are you sure?" query, the app would keep running, but I was unhooked.
The only way I could figure out to do it was to unload my DLL before I closed the app... This is why I went with the MFC dialog, since the framework handles "unhooking" gracefully.
I'm just curious in case I have to do it with a window hook in the future, for some reason.