Advertisement

SetTimer & TimerProc

Started by November 11, 2000 12:03 AM
3 comments, last by harry0418 24 years, 1 month ago
Can someone tell me why I get this error when trying to compile this code using VC++ 5.0? error C2664: ''SetTimer'' : cannot convert parameter 4 from ''void (void *,unsigned int,unsigned int,unsigned long)'' to ''int (__stdcall *)(void)'' ##################### CODE ################################### int PlaySnd(void) { SetTimer(hwndMain,PLAYBUTTON_TIMER_ID, nSndSampleLen,PlayTimerProc); return 0; } VOID CALLBACK PlayTimerProc(HWND hwnd,UINT message, UINT iTimerID, DWORD dwTime) { // Stuff..... } ###################### END OF CODE ############################## Thanks
Timer call backs dont (ie cant) take any parameters, and return as int

    //no ah ahVOID CALLBACK PlayTimerProc(HWND hwnd,UINT message, UINT iTimerID, DWORD dwTime)int PlayTimerProc(){return(false);}    


Edited by - Magmai Kai Holmlor on November 11, 2000 1:38:47 AM
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
Advertisement
You will need to use a cast on the last parameter of the SetTimer function, ie do this:

SetTimer(hwndMain,PLAYBUTTON_TIMER_ID, nSndSampleLen,(TIMERPROC)PlayTimerProc);

Hope this helps.
good question ha ha :-)

I like game very much, so I want to make more people like it !
Life is :-(Life is :-)
Thanks for your suggestions...

I downloaded the latest Platform SDK from
Microsoft that includes the lastest headers
and libs. That fixed the problem. My code
now compiles as is.

Thanks again.

This topic is closed to new replies.

Advertisement