UINT_PTR SetTimer(          HWND hWnd,
    UINT_PTR nIDEvent,
    UINT uElapse,
    TIMERPROC lpTimerFunc
);中的 回调函数 lpTimerFunc 能否是一个普通 C++ 类的普通成员函数呢.我 写了个类 CMyApp, 
void GApp::Run()
{
    MSG msg;    // 设定定时器
    SetTimer( NULL, 1, 1000, TimeProc ); // 这个 TimeProc 怎么化成 CMyApp 自己的处理函数呢    // 进入消息循环
    while ( GetMessage( &msg, NULL, 0, 0 ) )
    {
        if ( msg.message == WM_TIMER )
        {
            DispatchMessage( &msg );
        }
    }
    return 0;
}

解决方案 »

  1.   

    那个 MFC 的窗口类 OnTimer 又是怎么实现的 
      

  2.   

    既然在窗口类中可以调用自己的 OnTimer
    那么也能在自己的类(普通类,非窗口类) 中设置定时器调用自己类中的回调函数了, 给讲讲吧
      

  3.   

    只要是有消息过程函数的地方就能用SetTimer。
      

  4.   

    TimeProc()
    {
    theApp.AppTimeProc() ;
    }CMyApp::AppTimeProc()
    {
    printf("timer event") ;
    }
      

  5.   

    还要吧 CMyApp 定义为全局类啊