In all likelyhood, WM_DESTROY is being sent with SendMessage() and not with PostMessage(), and therefore does not go through the normal message pump. One of the default handlers for another message is probably sending a whole bunch of other messages to properly shut everything down.
IIRC, the first "close me" style message that is sent is WM_SYSCOMMAND with the WPARAM == SC_CLOSE. If you catch that and cut it off so that it doesn't call DefWindowProc(), it prevents the window from closing (I used to do this to stop it from closing if the user chose "cancel" from a "do you want to save" style message box -- if you try to stop WM_DESTROY, it's already to late to prevent the window from closing).
ANYway. So yeah... if you want WM_DESTROY to run through the message pump, then try catching WM_SYSCOMMAND and have it
PostMessage WM_DESTROY. Though beware that doing this might lead to possible memory leaks and/or program weirdness, because you're basically disrupting the entire shutdown process.
EDIT -- rather than write your own classes... have you looked into some crossplatform libs? wxWidgets does all this kind of thing already (application class, window management, OOP design, etc), and is portable to several platforms. It's worth looking into. Break away from Win-only design!
EDIT 2 -- apparently WM_SYSCOMMAND is a little funkier than that. Here's a snippit from my old code:
1 2
|
case WM_SYSCOMMAND:
if((w & 0xFFF0) == SC_CLOSE)
|
'w' here is the WPARAM. I have no idea if that's right or not (maybe it's the entire LOWORD and not just &0xFFF0), but it always worked for me.