Please read my other posts on the same issue for the reasons as to why I don't.
> You're not supposed to use PostMessage for WM_QUIT. Use PostQuitMessage
> instead.
[quoted text clipped - 9 lines]
> > I thought you were supposed to post WM_QUIT in response to WM_DESTROY
> > though?
Anyway, during WM_DESTROY, HWND may be already invalid. Actually, the reason
for failure is that when you do GetMessage, the window will already be
destroyed and the message will be discarded as invalid.
You're better with PostThreadMessage(GetCurrentThreadId(), WM_QUIT).
> Please read my other posts on the same issue for the reasons as to why I
> don't.
[quoted text clipped - 12 lines]
>> > I thought you were supposed to post WM_QUIT in response to WM_DESTROY
>> > though?
Bonj - 18 Nov 2004 14:12 GMT
I eventually found the cause of this ish.
It was that I was calling
while(GeMessage(&msg, hWnd, 0, 0) != 0)
instead of
while(GetMessage(&msg, NULL, 0, 0) != 0)
and due to this, PostQuitMessage doesn't actually post a message to the
hWnd, just to the thread. So the WM_QUIT message was being issued correctly,
it just wasn't getting through!
> Anyway, during WM_DESTROY, HWND may be already invalid. Actually, the
> reason for failure is that when you do GetMessage, the window will already
[quoted text clipped - 19 lines]
>>> > I thought you were supposed to post WM_QUIT in response to WM_DESTROY
>>> > though?