Click here to Skip to main content
15,889,467 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to capture a SetLastError (VS2008) / debug? Pin
Eugen Podsypalnikov23-Feb-10 23:36
Eugen Podsypalnikov23-Feb-10 23:36 
GeneralRe: How to capture a SetLastError (VS2008) / debug? Pin
Simon Langdon24-Feb-10 0:24
Simon Langdon24-Feb-10 0:24 
QuestionMessage Queues Pin
sharda.bhagwatkar23-Feb-10 22:13
sharda.bhagwatkar23-Feb-10 22:13 
AnswerRe: Message Queues Pin
Rajesh R Subramanian23-Feb-10 22:52
professionalRajesh R Subramanian23-Feb-10 22:52 
GeneralRe: Message Queues Pin
Roger Stoltz23-Feb-10 23:14
Roger Stoltz23-Feb-10 23:14 
GeneralRe: Message Queues Pin
Rajesh R Subramanian23-Feb-10 23:27
professionalRajesh R Subramanian23-Feb-10 23:27 
GeneralRe: Message Queues Pin
sharda.bhagwatkar24-Feb-10 0:40
sharda.bhagwatkar24-Feb-10 0:40 
GeneralRe: Message Queues Pin
Roger Stoltz24-Feb-10 1:04
Roger Stoltz24-Feb-10 1:04 
Yeah, I'm good too. Smile | :)
Looks like I've just been assigned to something that looks very promising and may last for at least this year. So I'm happy. Big Grin | :-D


Rajesh R Subramanian wrote:
I'm not sure I got your queries right; let me know if I've been unclear somewhere.


Ohhh, now you're asking for it my friend... Wink | ;)


Rajesh R Subramanian wrote:
I said a Window (the program) can have more than one Message Queue running


I think this adds to the confusion. It looks like you're saying that a window is a program and of course it's not.
To my understanding the question was never about whether an application can have more than one thread that has a message queue, or if an application may have multiple message queues.
I interpret the OP's question in short terms as "does the message queue belong to a thread or a window" and the correct answer for that in equally short terms can only be "the thread".


Rajesh R Subramanian wrote:
I think that the term "UI thread" is horribly misleading, as a UI thread need not have a UI associated with it at all!


Agreed at least a 100%!
The concept of "UI-thread" only makes sense as it is necessary to process messages when GUI objects are created in the thread.


Rajesh R Subramanian wrote:
I can of course re-route the messages internally if I have additional UI threads running within.


Yep, that's possible. But that's more related to ::PostThreadMessage() than window objects.
Never mind, it's beside the point.


I think the essential part of my point is that a window will only receive messages in the message queue that belongs to the thread that created the window.
We can look at it this way:
You send messages to windows by calling either ::SendMessage() or ::PostMessage(). They both need a window handle as argument.
The window retrieves the messages sent to it by calling e.g. ::GetMessage(), which also needs a window handle. The point I'm trying to make can be found in the documentation for ::GetMessage() that says "the window must belong to the calling thread".
This means that a UI-thread can only have one message queue and since a window can only belong to one thread, it can only have one message queue where messages sent to the window will be put.

"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknown


GeneralRe: Message Queues Pin
Rajesh R Subramanian24-Feb-10 1:56
professionalRajesh R Subramanian24-Feb-10 1:56 
AnswerRe: Message Queues Pin
Roger Stoltz23-Feb-10 22:57
Roger Stoltz23-Feb-10 22:57 
AnswerRe: Message Queues Pin
KingsGambit23-Feb-10 23:00
KingsGambit23-Feb-10 23:00 
Questionknowing the kind of exception for Heap Corruption problem in MFC application Pin
Prasann Mayekar23-Feb-10 22:10
Prasann Mayekar23-Feb-10 22:10 
AnswerRe: knowing the kind of exception for Heap Corruption problem in MFC application Pin
Adam Roderick J23-Feb-10 23:00
Adam Roderick J23-Feb-10 23:00 
AnswerRe: knowing the kind of exception for Heap Corruption problem in MFC application Pin
Richard MacCutchan24-Feb-10 1:06
mveRichard MacCutchan24-Feb-10 1:06 
AnswerRe: knowing the kind of exception for Heap Corruption problem in MFC application Pin
Stephen Hewitt24-Feb-10 17:46
Stephen Hewitt24-Feb-10 17:46 
QuestionCalling a Function in every x minutes Pin
jannathali23-Feb-10 21:58
jannathali23-Feb-10 21:58 
AnswerRe: Calling a Function in every x minutes Pin
Cedric Moonen23-Feb-10 22:02
Cedric Moonen23-Feb-10 22:02 
QuestionHow can i access class member variable directly without creating object of that class. Pin
Abhijit D. Babar23-Feb-10 21:27
Abhijit D. Babar23-Feb-10 21:27 
AnswerRe: How can i access class member variable directly without creating object of that class. Pin
CPallini23-Feb-10 21:30
mveCPallini23-Feb-10 21:30 
AnswerRe: How can i access class member variable directly without creating object of that class. Pin
KarstenK23-Feb-10 21:38
mveKarstenK23-Feb-10 21:38 
QuestionWhat is the use of ".rc2" file in MFC. Pin
Abhijit D. Babar23-Feb-10 21:18
Abhijit D. Babar23-Feb-10 21:18 
AnswerRe: What is the use of ".rc2" file in MFC. Pin
Nelek23-Feb-10 21:24
protectorNelek23-Feb-10 21:24 
GeneralRe: What is the use of ".rc2" file in MFC. Pin
Abhijit D. Babar23-Feb-10 21:28
Abhijit D. Babar23-Feb-10 21:28 
GeneralRe: What is the use of ".rc2" file in MFC. Pin
Nelek23-Feb-10 21:42
protectorNelek23-Feb-10 21:42 
AnswerRe: What is the use of ".rc2" file in MFC. Pin
KarstenK23-Feb-10 21:37
mveKarstenK23-Feb-10 21:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.