how to clean the message queue from timer-messages 
Author Message
 how to clean the message queue from timer-messages

Hey,

I am using the MFC on a Windows2000 platform.

after killing a timer I have to make sure that no further
run of the OnTimer() method will take place.
In the MSDN I found different descriptions about the
action the KillTimer() method will provide.
1) Any pending WM_TIMER messages associated with the timer
are removed from the message queue.
2) Any pending WM_TIMER messages associated with the timer
are not removed from the message queue.

As I am receiving timer messages after killing the timer
number 2 will be my choise.
So what I can do to clean up the message queue from any
pending timer message??

thanks for any help

Peter



Tue, 26 Apr 2005 12:33:39 GMT  
 how to clean the message queue from timer-messages
After you have killed your timer you could try:

MSG msg;
HWND hWnd = GetSafeHwnd();

while (::PeekMessage(&msg, hWnd, WM_PAINT, WM_PAINT, PM_REMOVE)
{
   if (msg.message == WM_QUIT)
   {
      ::PostQuitMessage();
      break;
   }

Quote:
}

If you I have never tried this with paint messages, but have used it to
remove WM_USER messages.

James


Quote:
> Hey,

> I am using the MFC on a Windows2000 platform.

> after killing a timer I have to make sure that no further
> run of the OnTimer() method will take place.
> In the MSDN I found different descriptions about the
> action the KillTimer() method will provide.
> 1) Any pending WM_TIMER messages associated with the timer
> are removed from the message queue.
> 2) Any pending WM_TIMER messages associated with the timer
> are not removed from the message queue.

> As I am receiving timer messages after killing the timer
> number 2 will be my choise.
> So what I can do to clean up the message queue from any
> pending timer message??

> thanks for any help

> Peter



Tue, 26 Apr 2005 12:57:32 GMT  
 how to clean the message queue from timer-messages
Peter,

Wouldn't it be enough to set a simple flag when you don't want to handle any
more messages?

Johan Rosengren
Abstrakt Mekanik AB


Quote:
> Hey,

> I am using the MFC on a Windows2000 platform.

> after killing a timer I have to make sure that no further
> run of the OnTimer() method will take place.
> In the MSDN I found different descriptions about the
> action the KillTimer() method will provide.
> 1) Any pending WM_TIMER messages associated with the timer
> are removed from the message queue.
> 2) Any pending WM_TIMER messages associated with the timer
> are not removed from the message queue.

> As I am receiving timer messages after killing the timer
> number 2 will be my choise.
> So what I can do to clean up the message queue from any
> pending timer message??

> thanks for any help

> Peter



Fri, 29 Apr 2005 19:00:08 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Reading legacy Message Queue messages

2. Exceeding the number of posted messages per message Queue under Win2K

3. Customized Messaging to Message Queue

4. Sending a message to the system message queue

5. What happens to WM_TIMER Messages if the message queue isn't empty

6. How many messages are waiting in a message queue

7. how many messages are awaiting in a message queue

8. message queue and message processing

9. TIMERS + Why does my queue timer crash?

10. Com .Net Message Queues and Console applications

11. Error when trying to send a message to a private queue in another domain

12. No Message Queue Freezes System

 

 
Powered by phpBB® Forum Software