Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

processing the message queue

Status
Not open for further replies.

copton

Programmer
Aug 8, 2001
7
DE
hi there
my application has to observe a certain input interface and display all its events.
i thought this would best be done by a flag controlled loop. this exit flag is set by a function which is mapped to a onclick event over a stop button.
but how can i tell my application to process its message queue after each loop, so that the flag can be set on the one hand, and the application still reacts on move events for instance on the other hand?
plz help
thx in advance
yours
copton

-----
and remember: there is no spoon!
 
each thread has its own message queue.
It means in each thread you can put. Is important what queues are not implemented at process level.
while(GetMessage(&msg,0,0,0))//extract msg from queue
{
//process there message or not is up to you
} John Fill
1c.bmp


ivfmd@mail.md
 
hey john
thx for your reply. but i am afraid i did not get you.
i read through the msdn libraries but did not find any solution. let me try to achieve an overview.
i have this application, which represents a single thread in the system. somewhere (in WinMain?) there is a sort of main loop which gets the messages from the thread's queue and dispatches them to the corresponding windows so that the mapped processes are started.
on of my processes has a loop which ends, if the user clicks a stop button and the break flag is set. that's the idea. but as this loop for its own is infinitive, the hole application is frozen.
it must be possible, to give control back to this main loop and to return as soon as all queued messages are processed, so that the application stays interactive.
hope you can help me now.

thx a lot
regards
copton

 
Maybe I can't understand you. Everywhere you call PostQuitMessage(x) the GetMessage will return 0 and you will exit this loop. You can have a loop even you have no windows in your program. So wher you PostQuitMessage you exit it.
For example in COM programming is usually
while(GetMessage(&msg,0,0,0)){DispatchMessage(&msg);}
when the COM objects reference count will be 0 the object will do PostQuitMessage even it doesn't have windows(or has). John Fill
1c.bmp


ivfmd@mail.md
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top