自己写的一个类,想用定时器...

解决方案 »

  1.   

    UINT_PTR SetTimer(
      HWND hWnd,              // handle to window
      UINT_PTR nIDEvent,      // timer identifier
      UINT uElapse,           // time-out value
      TIMERPROC lpTimerFunc   // timer procedure
    );
    很明显,需要一个窗口~ 所以建议还是让你的类派生于CWnd,这样方便~
      

  2.   

    解决了,不需要窗体的自己写TimerProc函数就ok-----------------------
    因为我要做的是一个浏览器的插件,越小越好哦,所以尽量精简,能不用dailog就不用哦  呵呵
      

  3.   

    The timeSetEvent function starts a specified timer event. The multimedia timer runs in its own thread. After the event is activated, it calls the specified callback function or sets or pulses the specified event object.MMRESULT timeSetEvent(
      UINT uDelay,                
      UINT uResolution,           
      LPTIMECALLBACK lpTimeProc,  
      DWORD dwUser,               
      UINT fuEvent                
    );Header: Declared in mmsystem.h.
    Import Library: Use winmm.lib.
      

  4.   

    不可能吧,TimerProc只能是静态函数,或者是类外部函数.
      

  5.   

    呵呵 那就申明static就是咯
      

  6.   

    既然都是static了,那你还怎么区别当前消息是属于类的哪个实例的呢?
      

  7.   

    settimer不是会返回一个值么?就用那个判断哦
      

  8.   

    to: tanchuhan
    我把TimerProc设为全局函数试了下,不清楚为什么,他还是不能接受其他类的WM_TIMER消息....
    写在哪个cpp里面,他才能接受那个类的....
      

  9.   

    原来可以哦...又是我自己弄错了,忘记调用那个settimer了 - -!