(转)WTL8.1的MSG_WM_TIMER事件

来源:互联网 发布:js object转array 编辑:程序博客网 时间:2024/06/05 10:21

BEGIN_MSG_MAP_EX(CMyWindow)
......
MSG_WM_TIMER(OnTimer)
......
END_MSG_MAP()

void OnTimer(UINT nIDEvent, TIMERPROC lpTimerFunc)
{
    if ( 1 != nIDEvent )
        SetMsgHandled(false);
    else
        RedrawWindow();
}

错误:C2660: “CMyWindow::OnTimer” : 函数不接受 1 个参数

看了一下WTL8.0 对MSG_WM_TIMER的宏定义
// void OnTimer(UINT_PTR nIDEvent)
#define MSG_WM_TIMER(func) /
if (uMsg == WM_TIMER) /
{ /
    SetMsgHandled(TRUE); /
    func((UINT_PTR)wParam); /
    lResult = 0; /
    if(IsMsgHandled()) /
    return TRUE; /
}


void OnTimer(UINT nIDEvent, TIMERPROC lpTimerFunc)
改成void OnTimer(UINT nIDEvent)就搞定了~

http://blog.csdn.net/hellward/article/details/5415084

0 0