轻松实现非客户区按钮
2010-09-04 20:48:21 来源:WEB开发网2.5 消息的处理
2.5.1 将消息转发给管理类
LRESULT CMainFrame::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
LRESULT lResult = CFrameWnd::DefWindowProc(message, wParam, lParam);
if(!IsWindow(this->m_hWnd))
return lResult;
LRESULT lMyResult = m_NcButtonManager.DefWindowProc(this->m_hWnd, message, wParam, lParam);
if(lMyResult != 0)
return lMyResult;
else
return lResult;
}
2.5.2 添加消息处理函数
// Operations
public:
void OnNcButton1Clicked();
void CMainFrame::OnNcButton1Clicked()
{
AfxMessageBox("VC知识库欢迎您! www.vckbase.com");
}
2.5.3 消息映射
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
//{{AFX_MSG_MAP(CMainFrame)
ON_BN_CLICKED(ID_BUTTON1, OnNcButton1Clicked)
ON_BN_CLICKED(ID_BUTTON2, OnNcButton2Clicked)
ON_BN_CLICKED(ID_BUTTON3, OnNcButton3Clicked)
ON_WM_CREATE()
/
本文配套源码
更多精彩
赞助商链接