三个参数不知道是什么!此外,为什么要调用Invalidate()这个函数?

解决方案 »

  1.   

    第一个参数是定时器ID,第二个是时间间隔(以毫秒为单位),第三个是响应这个时钟到来时的回调函数,如果为NULL,WM_TIMER消息被发送到通常的窗口消息处理程序,否则Windows直接将定时器消息发送给您程序的另一个函数(就是那个回调函数)。
    调用Invalidate()触发WM_PANIT消息,并将其推入消息队列
      

  2.   

    Installs a system timer. 
    UINT_PTR SetTimer(
       UINT_PTR nIDEvent,
       UINT nElapse,
       void (CALLBACK* lpfnTimer
    )(HWND,
       UINT,
       UINT_PTR,
       DWORD

    );
     
    Parameters
    nIDEvent
    Specifies a nonzero timer identifier.nElapse
    Specifies the time-out value, in milliseconds.lpfnTimer
    Specifies the address of the application-supplied TimerProc callback function that processes the WM_TIMER messages. If this parameter is NULL, the WM_TIMER messages are placed in the application's message queue and handled by the CWnd object.***************************************************
    This example uses CWnd::SetTimer, CWnd::OnTimer, and CWnd::KillTimer to handle WM_TIMER messages. A timer is set up to send a WM_TIMER message to the main frame window every 2 seconds in OnStartTimer. OnStopTimer will stop the timer by calling CWnd::KillTimer. OnTimer was set up to handle WM_TIMER messages for the main frame window. In this example, the PC speaker will beep every 2 seconds.
    *****************************
    void CMainFrame::OnStartTimer() 
    {
       m_nTimer = SetTimer(1, 2000, 0);
    }void CMainFrame::OnStopTimer() 
    {
       KillTimer(m_nTimer);   
    }void CMainFrame::OnTimer(UINT nIDEvent) 
    {
       MessageBeep(0xFFFFFFFF);   // Beep   // Call base class handler.
       CMDIFrameWnd::OnTimer(nIDEvent);
    }
      

  3.   

    基本用法就是先settimer设置定时器
    然后在ontimer中做处理动作
      

  4.   

    The client area is ed for painting when the next WM_PAINT message occurs. The region can also be validated before a WM_PAINT message occurs by the ValidateRect or ValidateRgn member function.The bErase parameter specifies whether the background within the update area is to be erased when the update region is processed. If bErase is TRUE, the background is erased when the BeginPaint member function is called; if bErase is FALSE, the background remains unchanged. If bErase is TRUE for any part of the update region, the background in the entire region, not just in the given part, is erased. Windows sends a WM_PAINT message whenever the CWnd update region is not empty and there are no other messages in the application queue for that window.
      

  5.   

    ininDlg()
    {
    ...
    SetTimer(1,1000,0);
    ...
    }void Cjpg2gifDlg::OnTimer(UINT nIDEvent)
    {
    //MessageBox("1");  若去掉注释,就 每隔1秒 都进入此函数,否则不会!
    CString nowtime;
    SYSTEMTIME   Now;   
       GetLocalTime(&Now);   
       nowtime.Format("%4d-%02d-%02d-%02d",Now.wYear,Now.wMonth,Now.wDay,Now.wMilliseconds);
    this->SetWindowText(nowtime);
    CDialog::OnTimer(nIDEvent);
    }
     怪!   为什么?
      

  6.   

    自己搞错了,有反应的!Now.wMiliseconds 这个似乎取不到值!