settimer函数
然后处理WM_TIMER里面写定时做什么

解决方案 »

  1.   

    最好给我个定时的例子,用控件或者API函数都行
      

  2.   

    WM_TIMER这个消息里面写具体执行的东西
    settimer()写间隔时间
    CWnd::SetTimer
    UINT SetTimer( UINT nIDEvent, UINT nElapse, void (CALLBACK EXPORT* lpfnTimer)(HWND, UINT, UINT, DWORD) );Return ValueThe timer identifier of the new timer if the function is successful. An application passes this value to the KillTimer member function to kill the timer. Nonzero if successful; otherwise 0.ParametersnIDEventSpecifies a nonzero timer identifier.nElapseSpecifies the time-out value, in milliseconds.lpfnTimerSpecifies 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.
      

  3.   

    有没有想CB中那样的Timer控件啊,精度低一点没关系的。
      

  4.   

    不知你想对什么定时?你可以在程序中设置定时器,就跟Timer控件一样好用。
    比如在程序启动时设置UINT timer=SetTimer(1,1000,NULL),即为一秒定时器,然后处理OnTimer()函数,程序结束前,KillTimer(timer).
    如果你想使用高精度定时,那采用GetTickCount(),他的精度是1微秒。
    QueryPerformanceFrequerncy()得到高精度计时器频率。
    QueryPerformanceCounter得到高精度计时器的当前计数值。
      

  5.   

    vc里大多数控件不是像别的语言里那么方便拖拖拽拽就可以了,而是用写的。
    这也许就是vc开发周期相对长的原因,不过可能也是他独具魅力的原因。
      

  6.   

    用UINT SetTimer( UINT nIDEvent, UINT nElapse, void (CALLBACK EXPORT* lpfnTimer)(HWND, UINT, UINT, DWORD) );
    函数的时候需要加哪个头文件啊,我这里没有MSDN,我刚开始学VC,哪位朋友能给一个应用此API函数的例子不胜感激!