Lost thread messages, or: What does DispatchMessage do w
ivan_johannessen@invision.iip.com
Thursday, October 03, 1996
Look at article
Q142415(http://www.microsoft.com/developr/visual_c/q142415.htm) from
the Microsoft Knowledge Base. It says that messages posted across
threads should be handled in PreTranslateMessage.
ivan
______________________________ Reply Separator _________________________________
Subject: Lost thread messages, or: What does DispatchMessage do when
Author: uunet!netcom.com!mfc-l at Internet
Date: 10/2/96 7:45 PM
Environment: Win95, VC4.2
Problem: Messages sent with PostThreadMessage() are sometimes not =
received in my app's main message pump. Why?
I have a worker thread in my MFC app which communicates with my main =
thread by PostThreadMessage(). The problem is, that while I resize my =
main window, these messages never get recieved by my main message pump.
My latest theory goes like this: during resize, someone else (such as a =
dialog box) calls GetMessage(msg, NULL, ...) and removes my thread =
message from the queue. Then, they call DispatchMessage(). The problem =
is, DispatchMessage is only defined for messages with a valid hWnd. =
What happens to thread messages (where hWnd=3D=3D0)? I suspect that =
these messages are thrown away before they can arrive at my main message =
pump.
The documentation for DispatchMessage doen't mention the case where =
hWnd=3D=3DNULL. Anyone know for sure?
Thanks in advance,
--Noel
-----------------------------------------------------
Noel Burton-Krahn
noel@harleystreet.com
Mike Blaszczak -- mikeblas@nwlink.com
Sunday, October 06, 1996
At 09:09 10/3/96, ivan_johannessen@invision.iip.com wrote:
>>Environment: Win95, VC4.2
> Look at article
> Q142415(http://www.microsoft.com/developr/visual_c/q142415.htm) from
> the Microsoft Knowledge Base. It says that messages posted across
> threads should be handled in PreTranslateMessage.
This is bad advice: please read the question and KB article more carefully.
The Questioner states that they're using VC 4.2, and the KB article mentions
ON_THREAD_MESSAGE() being available in 4.2.
In MFC 4.2 flat, ON_THREAD_MESSAGE() had a couple of problems. All of
the known problems were fixed in MFC 4.2b.
.B ekiM
http://www.nwlink.com/~mikeblas/
Don't look at my hands: look at my _shoulders_!
These words are my own. I do not speak on behalf of Microsoft.
| Вернуться в корень Архива
|