An application can process WM_TIMER messages by including a WM_TIMER case statement in the window procedure or by specifying a TimerProc callback function when creating the timer. When you specify a TimerProc callback function, the default window procedure calls the callback function when it processes WM_TIMER. Therefore, you need to dispatch messages in the calling thread, even when you use TimerProc instead of processing WM_TIMER.
The wParam parameter of the WM_TIMER message contains the value of the nIDEvent parameter.
The timer identifier, nIDEvent, is specific to the associated window. Another window can have its own timer which has the same identifier as a timer owned by another window. The timers are distinct.
这里想说明一个问题, SetTimer(NULL, NULL, 2000, (TIMERPROC)TimerFunc);
TimerFunc是马上执行还是2000毫秒后再执行呢?
SetTimer 仅仅注册一个处理WM_TIMER的处理函数,所以2000后TimerFunc才被执行。