WM_TIMER message never arrives [modified]
-
Hanan888 wrote:
I do graphic rendering.
That's it you are performing lengthy operation.
Hanan888 wrote:
Still, I must use timer to acheive the delay.
in your rendering loop, you can find the elapsed time since last time message posted and find out the delay. And if you find that delay you actually don't need to post message, you can call the handler for WM_TIMER directly in the rendering loop. but still i am not convinced why SetTimer() is not working.
Thanks again.
Rajkumar R wrote:
in your rendering loop, you can find the elapsed time since last time message posted and find out the delay. And if you find that delay you actually don't need to post message, you can call the handler for WM_TIMER directly in the rendering loop.
Yes, in rendering I check the time now and calculate the delay or something like that (some other from my team implemented these stuff). But what I need is triggering some GUI and rendering and business-logic events, orchestrating them with time delays. And it all worked before something got funky. All messages (PAINT, LBUTTONDOWN,...) go exactly where I need them.
PostMessage(m_hWnd,WM_TIMER,SPECIFIC_CONST,NULL);
get where I expect it to go. onlySetTimer(m_hWnd,SPECIFIC_CONST,1000,NULL)
never get to thecase WM_TIMER:
Rajkumar R wrote:
but still i am convinced why SetTimer() is not working.
Do you mean you're still not convinced ?
-
In my Win32 application, I register several window classes, each class have a different message procedure. Then, I create several windows. I call
SetTimer(m_hWnd, SPECIFIC_MESSAGE_CONSANT,1000, NULL);
As far as I know: This should send a WM_TIMER with wParam = SPECIFIC_MESSAGE_CONSANT, with one second time delay. To the message procedure of the window class that m_hWnd (HWND) was created from. whereSPECIFIC_MESSAGE_CONSANT = 11761
In my int APIENTRY _tWinMain() I do:MSG msg; ZeroMemory( &msg, sizeof(msg) ); while( msg.message!=WM_QUIT ) { if( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) ) { _//my WM_TIMER dont get here_ TranslateMessage( &msg ); DispatchMessage( &msg ); } else { } }
WM_TIMER never arrives to the place marked above. I triedPostMessage(m_hWnd,WM_TIMER,SPECIFIC_MESSAGE_CONSANT,NULL)
-> got exactly where expected. Still, I must have the time delay.modified on Tuesday, February 26, 2008 6:20 AM
Thank you all for help and invaluable knowledge !!! I sure learned a lot. It turns out, I stuck too much in the
case WM_PAINT:
, and that clogged theWM_TIMER
messages. I rendered all my windows onWM_PAINT
(DirectX stuff). Now, When I drag my windows some ungraceful visual effects happen, but I guess I'll manage.