为何回调函数不执行??我在类的构造函数里写
uTSystemFun1()
{
    TIMERPROC pTime = (TIMERPROC)OnTime;
    SetSavePointType();
    // create control for timer
    m_hWnd = ::CreateWindow("static", "", 0, 0, 0, 0, 0, NULL, NULL, 0, NULL);
    ::SetWindowLong(m_hWnd , GWL_USERDATA , (long)(this) );
    SetTimer(m_hWnd,1,1000,pTime);
}
回调函数为:
    static void OnTime()//.HWND h,UINT u1,UINT u2,DWORD d) 
    {if (CpuTime == MaxSavePoint)
    {
         CpuUsagePos();
         CpuTime=CpuTime-1;
     }
    CpuUsageSun.TSavePoint[CpuTime]=CpuTime;
    CpuTime=CpuTime+1;
} 在main()里:uTSystemFun1 *sys = new uTSystemFun1;可为何OnTime()一直不执行啊 ??

解决方案 »

  1.   

    uTSystemFun1 *sys = new uTSystemFun1;要放在主消息循环 Main message loop的前面
      

  2.   

    那你把uTSystemFun1 *sys = new uTSystemFun1;放在main()的哪里了,最后面?
      

  3.   

    void main(void)
    {
        uTSystemFun1 *sys = new uTSystemFun1;
        ************
        ***********
    }
      

  4.   

    其实已经执行了,只不过立即又终止了,当程序出现Press any key to continue,程序已经终止,你可以在uTSystemFun1 *sys = new uTSystemFun1;
    后面加上MessageBox(m_hWnd,"wait","wait",MB_OK);看看回调函数是否在执行?