解决方案 »

  1.   

    int g_nTimerId = 0;VOID CALLBACK TimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
    {
    if(idEvent == g_nTimerId)
    {
    static int nIndex = 0;
    printf("%d, Hello\r\n", ++nIndex);
    }
    }int _tmain(int argc, _TCHAR* argv[])
    {
    g_nTimerId = SetTimer(NULL, 1, 1000, TimerProc);
    MSG msg;
    while(GetMessage(&msg, NULL, 0, 0))
    {
    TranslateMessage(&msg);
    DispatchMessage(&msg);
    }
    return 0;
    }类似这样??
      

  2.   

    在网上搜了一下,SetTimer有两种,CWnd和Windows API,前一种     
     UINT_PTR SetTimer(
                 UINT_PTR nIDEvent,
                 UINT nElapse,
                 void (CALLBACK* lpfnTimer
           )(HWND,
              UINT,
              UINT_PTR,
              DWORD
           ) 
           );
    后一种:
    UINT_PTR SetTimer(         
        HWND    
                hWnd,   
        UINT_PTR    
                nIDEvent,   
        UINT    
                uElapse,   
        TIMERPROC    
                lpTimerFunc   
    );