Prev: How to convert 2 WCHAR to 1 WCHAR
Next: FreeImage
From: Joseph M. Newcomer on 9 Sep 2009 14:32 More context is required here. For example, it is a common error to think that OnTimer will be called every nInterval, but nobody mentions "I'm off doing a long computation". Since WM_TIMER messages are dispatched ONLY when the message pump is running, and a long computation blocks the message pump, this would not work under those conditions. You have given far too much out of context here; you corrected at least one point and said that you know the window actually exists when SetTimer is called, and you have an ON_WM_TIMER in your Message Map. So you need to clarify the conditions. Note that if you want 1-second notifications while a long computation is running, doing the long computation in the main thread is a mistake. You would want to do the long computation in a secondary thread. joe On Wed, 9 Sep 2009 07:59:28 -0700, "SteveS" <sserrell(a)wagstaff.com> wrote: >studio 2005 vc8 > >my code : ------------------------------------------- > > >UINT nHandle = StartTimer(5000); > >UINT CMainFrame::StartTimer(int nInterval) >{ > UINT nTimer = SetTimer(1, nInterval, NULL); > return nTimer; >} > >void CMainFrame::OnTimer(UINT_PTR nIDEvent) >{ > DoStuff(); > > //default handling > CFrameWnd::OnTimer(nIDEvent); >} > >//------------------------------------------------ > >OnTimer in never called! > >Am i missing something? > >Thanks > Joseph M. Newcomer [MVP] email: newcomer(a)flounder.com Web: http://www.flounder.com MVP Tips: http://www.flounder.com/mvp_tips.htm |