zoukankan      html  css  js  c++  java
  • CFindReplaceDialog学习

    The CFindReplaceDialog class allows you to implement standard string Find/Replace dialog boxes in your application. Unlike the other Windows common dialog boxes, CFindReplaceDialog objects are modeless, allowing users to interact with other windows while they are on screen. There are two kinds of CFindReplaceDialog objects: Find dialog boxes and Find/Replace dialog boxes. Although the dialog boxes allow the user to input search and search/replace strings, they do not perform any of the searching or replacing functions. You must add these to the application.

    To construct a CFindReplaceDialog object, use the provided constructor (which has no arguments). Since this is a modeless dialog box, allocate the object on the heap using the new operator, rather than on the stack.

    Once a CFindReplaceDialog object has been constructed, you must call the Create member function to create and display the dialog box.

    Use the m_fr structure to initialize the dialog box before calling Create. The m_fr structure is of type FINDREPLACE. For more information on this structure, see the Win32 SDK documentation.

    In order for the parent window to be notified of find/replace requests, you must use the Windows RegisterWindowMessage function and use the ON_REGISTERED_MESSAGE message-map macro in your frame window that handles this registered message. You can call any of the member functions listed in the “Operations” section of the CFindReplaceDialog Class Members table from the frame window’s callback function.

    You can determine whether the user has decided to terminate the dialog box with the IsTerminating member function.

    CFindReplaceDialog relies on the COMMDLG.DLL file that ships with Windows versions 3.1 and later.

    To customize the dialog box, derive a class from CFindReplaceDialog, provide a custom dialog template, and add a message map to process the notification messages from the extended controls. Any unprocessed messages should be passed to the base class.

    Customizing the hook function is not required.

    /*
         第一个参数为true显示的是查找对话框,为False时显示的是查找和替换对话框
         第二个参数指定在查找对话框中显示的字符串
         第三个参数指定在替换对话框中显示的字符串
         第四个参数为指定标志位,用来定制对话框,其中FR_DOWM表示对话框中的“向下”单选按钮被选中,否则“向上”单选按钮被选中,具体可取值参考MSDN
         第五个参数为指向父窗口的指针,如果为NULL,则为主框架窗口,使用时需要让它指向接收查找和替换消息的窗口
     */
    void CMfcFindReplaceDlgDlg::OnBtnF() 
    {
        CFindReplaceDialog* pFRDlg = new CFindReplaceDialog();  // Must be created on the heap    
        pFRDlg->Create( TRUE, "", "", FR_DOWN, this );     
    }
    
    void CMfcFindReplaceDlgDlg::OnBtnFr() 
    { 
        CFindReplaceDialog* pFRDlg = new CFindReplaceDialog();  // Must be created on the heap    
        pFRDlg->Create( FALSE, "", "", FR_DOWN, this );     
    }

  • 相关阅读:
    网络编程实验一 win socket基础 获取服务器时间
    ASP.NET Core入门
    vue-element-template 获取后端路由表动态生成权限
    vue-admin-template只有一个子菜单时父级菜单不显示问题
    vue-element-template 本地使用proxy解决跨域问题
    已成功与服务器建立连接,但是在登录过程中发生错误。 (provider: SSL Provider, error: 0
    系统还未初始化,还不能审核期间以后的单据
    金蝶初始化问题
    jqueryMobile 动态添加元素,展示刷新视图方法
    链接数据库 远程事务的处理方式
  • 原文地址:https://www.cnblogs.com/MakeView660/p/7705628.html
Copyright © 2011-2022 走看看