关于c++:DuiLib-HandleMessage-HandleCustomMessage-MessageHandler

5次阅读

共计 633 个字符,预计需要花费 2 分钟才能阅读完成。

HandleMessage HandleCustomMessage MessageHandler 三者区别

LRESULT CWindowWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{return ::CallWindowProc(m_OldWndProc, m_hWnd, uMsg, wParam, lParam);
}
LRESULT WindowImplBase::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{lRes = HandleCustomMessage(uMsg, wParam, lParam, bHandled);
    if (bHandled) return lRes;

    if (m_PaintManager.MessageHandler(uMsg, wParam, lParam, lRes))
        return lRes;
    return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
}
//CWindowWnd 是父类,WindowImplBase 是子类
class UILIB_API WindowImplBase : public CWindowWnd


如果派生类 如果实现这些虚函数 执行程序如下:HandleMessage --> HandleCustomMessage --> MessageHandler


因而只有实现 HandleCustomMessage 即可
正文完
 0