|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
Updated: May 2009
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.
In order for the parent window to be notified of find/replace requests, you must use the Windows RegisterWindowMessage function to register the FINDMSGSTRING message and you must use the ON_REGISTERED_MESSAGE message-map macro in your frame window that handles this registered message.
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.
For more information on using CFindReplaceDialog, see Common Dialog Classes.
The FR_WHOLEWORD flag in the m_fr data member is not supported in Windows CE-based projects. CFindReplaceDialog::MatchWholeWord will not function properly even when the "Find whole word" checkbox is checked.