0
点赞
收藏
分享

微信扫一扫

MFC 使用注册窗口信息的方式获取CFindReplaceDialog控件消息

首先在主对话框注册消息

MFC 使用注册窗口信息的方式获取CFindReplaceDialog控件消息_获取CFindReplaceDialog

添加消息

class CMainFrame : public CFrameWnd
{

static const UINT WM_FINDREPLACE;//定义消息
CFindReplaceDlg* m_pFindDlg{};
protected:
afx_msg LRESULT OnFindreplace(WPARAM wParam, LPARAM lParam);
}


//消息映射表
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
ON_REGISTERED_MESSAGE(WM_FINDREPLACE, OnFindreplace)
END_MESSAGE_MAP()


const UINT CMainFrame::WM_FINDREPLACE = ::RegisterWindowMessage(FINDMSGSTRING);//注册


LRESULT CMainFrame::OnFindreplace(WPARAM wParam, LPARAM lParam)
{
if (!m_pFindDlg->GetSafeHwnd())
return -1;
if (m_pFindDlg->IsTerminating())
{//点击了cancel按钮,destroywindows由FRDlg内部执行
this->OnDestroy();
return 0;
}

if (m_pFindDlg->ReplaceAll())
//TODO...
if (m_pFindDlg->ReplaceCurrent())
//TODO...
if (m_pFindDlg->FindNext())
//TODO...
return 0;
}


举报

相关推荐

0 条评论