Menu - loop of sending and receiving WM_TIMER

Jose Alonso alonso at estadao.com.br
Thu Apr 14 12:33:21 CDT 2005


On Thu, 2005-04-14 at 15:53 +0200, Alexandre Julliard wrote:
> Jose Alonso <alonso at estadao.com.br> writes:
> 
> >         for (;;)
> >         {
> > (1)         if (PeekMessageW( &msg, 0, 0, 0, PM_NOREMOVE ))
> >         ...
> >         {
> > (2)          DispatchMessageW( &msg );
> >         }
> >         if (!fEndMenu) fRemove = TRUE;
> > 
> >         /* finally remove message from the queue */
> > 
> >         if (fRemove && !(mt.trackFlags & TF_SKIPREMOVE) )
> > (3)       PeekMessageW( &msg, 0, msg.message, msg.message, PM_REMOVE );
> >         else mt.trackFlags &= ~TF_SKIPREMOVE;
> >     }
> > 
> > (1) The WM_TIMER is peeked and the timer is not restarted (PM_NOREMOVE)
> > (2) The WM_TIMER is dispatched here
> > (3) The WM_TIMER is only removed from the queue.
> > The next PeekMessageW (1) return immediately with WM_TIMER since the
> > timer was not restarted.
> 
> The timer was restarted in (3), so I'd expect things to work right.
> There must be something else going on here.
> 

The timer was not restarted in (3), because the message is
removed in remove_queue_message.

DECL_HANDLER(get_message)
...
   if (get_posted_message( queue, ...
...
get_posted_message
        ...
        remove_queue_message( queue, msg, POST_MESSAGE );

I think that another solution would be to check in the
remove_queue_message if the message is WM_TIMER or
WM_SYSTIMER and restart the corresponding timer.

    alonso




More information about the wine-devel mailing list