请教高手,定时器TIMER问题
部分程序如下:
case WM_CREATE:
// Start the timer.
idTimer=SetTimer(hWnd, 1, 100, NULL);
break;
case WM_TIMER://定时器消息
DrawEls();
break;我的定时器就是不工作,WM_TIMER事件根本就没有发生,这是什么原因。请高手作答。
部分程序如下:
case WM_CREATE:
// Start the timer.
idTimer=SetTimer(hWnd, 1, 100, NULL);
break;
case WM_TIMER://定时器消息
DrawEls();
break;我的定时器就是不工作,WM_TIMER事件根本就没有发生,这是什么原因。请高手作答。
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
//PAINTSTRUCT ps;
//HDC hdc;
TCHAR szHello[MAX_LOADSTRING];
LoadString(hInst, IDS_HELLO, szHello, MAX_LOADSTRING); switch (message)
{
case WM_CREATE:
// Calculate the starting point. // Start the timer.
idTimer=SetTimer(hWnd, 100, 100 ,NULL); break;
case WM_TIMER://定时器消息
DrawEls();
break;
}
要是改成SetTimer(this,100,100,NULL);
编译时会出错如下
error C2673: 'WndProc' : global functions do not have 'this' pointers
case WM_CREATE:
// Calculate the starting point. // Start the timer.
idTimer=SetTimer(hWnd, 100, 100 ,NULL);
这段语句了吗?