UINT nid = ::SetTimer(NULL, 0,100,(TIMERPROC) MyTimerProc);
where TimerProc is defined as
void CALLBACK MyTimerProc(
HWND hWnd, // handle of CWnd that called SetTimer
UINT nMsg, // WM_TIMER
UINT nIDEvent, // timer identification
DWORD dwTime // system time
)
{
switch(nMsg)
{
case WM_TIMER:
break;
}
}
I dont know why but i dont get the WM_TIMER event in the callback
function..i mean the function TimerProc is never called even after the time
specified in SetTimer() function..Is the problem with my CallBack function
or what. coz it seems to be working well in other applications..that are not
services.
Thanx and regards
Usman Jamil
and handle WM_TIMER notification? Is there any special reason for you to
define your own timer procedure? If I'm wrong, correct me please.
Regards,
Peter
"Usman Jamil" <us...@advcomm.net> wrote in message
news:uQPRwD6S...@TK2MSFTNGP11.phx.gbl...
You will only get timer callbacks if your message pump is active, so if you are off doing
some long computation, no timer events will be seen.
joe
Joseph M. Newcomer [MVP]
email: newc...@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
>I dont know why but i dont get the WM_TIMER event in the callback
>function..i mean the function TimerProc is never called even after the time
>specified in SetTimer() function..Is the problem with my CallBack function
>or what. coz it seems to be working well in other applications..that are not
>services.
If you don't have a message pump (which seems likely in a service),
then your callback won't be called. The "callback" for a timer is
actually called from within message processing in your thread, not by
Windows itself.
You might be better off looking at multimedia timers - see the docs
for timeSetEvent. These support "true" callbacks.
--
Bob Moore [WinSDK MVP]
http://www.mooremvp.freeserve.co.uk/
(this is a non-commercial site and does not accept advertising)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Do not reply via email unless specifically requested to do so.
Unsolicited email is NOT welcome and will go unanswered.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
thanx and regards
Usman Jamil
"Bob Moore" <bo...@mvps.org> wrote in message
news:n1jbhv8sabc2hongt...@4ax.com...
>can u please tell me if there is some
>problem in using multiple mutimedia timers..or is there any check i must
>make using mutimedia timer to avoid such situations..
I am not aware of any such problem relating to multimedia timers.
Provided that your threads call timeKillEvent before their run
function exits there shouldn't be any issue. Possibly the problem lies
in your threading architecture - was there a problem before you
started using multimedia timers, or did you never get as far as
testing shutdown ?