zoukankan      html  css  js  c++  java
  • VC:CFindReplaceDialog(非模态对话框、IsWindow()、m_fr、GetFindString())

    1、新建:

           if(pdlg!=NULL&&::IsWindow(pdlg->m_hWnd))

                  pdlg->ShowWindow(SW_SHOW);

           else

           {

                  pdlg=new CFindReplaceDialog();

                  pdlg->m_fr.Flags=pdlg->m_fr.Flags|FR_MATCHCASE|FR_WHOLEWORD;

           }

           if(!::IsWindow(pdlg->m_hWnd))

           {

                  pdlg->Create(FALSE,"字符串","改变字符串");

                  pdlg->ShowWindow(SW_SHOW);

           }

    2、消息映射:

           1)

           //{{AFX_MSG(CDialogDlg)

           afx_msg long OnFindReplace(WPARAM wParam,LPARAM lParam);

           //}}AFX_MSG

           DECLARE_MESSAGE_MAP()

           2)

           BEGIN_MESSAGE_MAP(CDialogDlg, CDialog)

           //{{AFX_MSG_MAP(CDialogDlg)

          

           ON_REGISTERED_MESSAGE(WM_FINDREPLACE,OnFindReplace)

          

           //}}AFX_MSG_MAP

           //    

           END_MESSAGE_MAP()

    3、输出信息

                  CString message="";

                  if(pdlg->FindNext())

                  {

                  message+="查找下一个、\n\r";

                  }

                  message+="查找内容:";

                  message+=pdlg->GetFindString();

                  message+="\n\r";

                  message+="替换内容:";

                  message+=pdlg->GetReplaceString();

                  message+="\n\r";

                  AfxMessageBox(message);

                  return 0;

  • 相关阅读:
    c# 定义委托和使用委托(事件的使用)
    c# 继承与多种状态
    ref 参数与out参数
    c# 类
    foreach 语句
    c# 制作弹窗
    c#常用类
    Python中的OS对路径的操作以及应用
    Git 推送文件到远程仓库
    Python基础 函数
  • 原文地址:https://www.cnblogs.com/shenchao/p/2737749.html
Copyright © 2011-2022 走看看