[指导一下吧~~!]还是不会用TimerProc来处理定时器函数~~!!!
Gutta 2005-08-03 10:15:39 类定义成员函数TimerProc
VOID CALLBACK TimerProc(
HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime );
在BOOL CADlg::OnInitDialog()成员函数中定义一个定时器:
SetTimer(1,500,TimerProc);
这个函数是成员函数TimerProc的实现部分:
VOID CALLBACK CADlg::TimerProc(HWND hwnd, UINT uMsg,UINT idEvent, DWORD dwTime)
{
static int px=0;
CClientDC dc(this);
dc.TextOut(px,20,_T("Hello"));
CRect rectClient;
GetClientRect(&rectClient);
if (px > rectClient.right - 10)
KillTimer(1);
else
px = px + 10;
}
编译时, SetTimer(1,500,TimerProc);语句发生错误,说是:
error C2664: 'SetTimer' : cannot convert parameter 3 from 'void (struct HWND__ *,unsigned int,unsigned int,unsigned long)' to 'void (__stdcall *)(struct HWND__ *,unsigned int,unsigned int,unsigned long)'
None of the functions with this name in scope match the target type
----------------------------------------
各位大虾,指导一下啦~~~~