Advertisement

TimerProc: I got it to semi-work...

Started by March 24, 2000 09:11 PM
0 comments, last by Zipster 24 years, 8 months ago
I have a SetTimer like this: SetTimer(main_window, 1, 1000, TimerProc); and a TimerProc Callback function like this: VOID CALLBACK TimerProc(HWND window, UINT message, UINT Id, DWORD dwTime) { switch(Id) { case(1): { sec++; } break; } } this is correct, however the Id is never one because I notice sec never increments. however, when i change it to this: VOID CALLBACK TimerProc(HWND window, UINT message, UINT Id, DWORD dwTime) { sec++; } it works. i guess ill have trouble getting it to be able to distingquish between different timers, if it can''t handle one timer.

I noticed that your declaration of your timer proc was:

void CALLBACK timerproc(HWND, UINT, UINT, DWORD);

The documentation calls for:

void CALLBACK timerproc(HWND, UINT, UINT_PTR, DWORD);

I don''t know if that might be throwing it off.

Usually, if its just a single timer, you can get by just allowing it to post WM_TIMER messages to your message proc (WNDPROC). That way, you just have to respond to WM_TIMER messages..you may still have to verify that the timer id is what your looking for.

HTH,

-mordell
__________________________________________

Yeah, sure... we are laughing WITH you ...

This topic is closed to new replies.

Advertisement