Compartilhar via


CFindReplaceDialog Class

Allows you to implement standard string Find/Replace dialog boxes in your application.

class CFindReplaceDialog : public CCommonDialog

Members

Public Constructors

Name

Description

CFindReplaceDialog::CFindReplaceDialog

Call this function to construct a CFindReplaceDialog object.

Public Methods

Name

Description

CFindReplaceDialog::Create

Creates and displays a CFindReplaceDialog dialog box.

CFindReplaceDialog::FindNext

Call this function to determine whether the user wants to find the next occurrence of the find string.

CFindReplaceDialog::GetFindString

Call this function to retrieve the current find string.

CFindReplaceDialog::GetNotifier

Call this function to retrieve the FINDREPLACE structure in your registered message handler.

CFindReplaceDialog::GetReplaceString

Call this function to retrieve the current replace string.

CFindReplaceDialog::IsTerminating

Call this function to determine whether the dialog box is terminating.

CFindReplaceDialog::MatchCase

Call this function to determine whether the user wants to match the case of the find string exactly.

CFindReplaceDialog::MatchWholeWord

Call this function to determine whether the user wants to match entire words only.

CFindReplaceDialog::ReplaceAll

Call this function to determine whether the user wants all occurrences of the string to be replaced.

CFindReplaceDialog::ReplaceCurrent

Call this function to determine whether the user wants the current word to be replaced.

CFindReplaceDialog::SearchDown

Call this function to determine whether the user wants the search to proceed in a downward direction.

Public Data Members

Name

Description

CFindReplaceDialog::m_fr

A structure used to customize a CFindReplaceDialog object.

Remarks

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 Windows SDK.

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 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.

Inheritance Hierarchy

CObject

CCmdTarget

CWnd

CDialog

CCommonDialog

CFindReplaceDialog

Requirements

Header: afxdlgs.h

See Also

Reference

CCommonDialog Class

Hierarchy Chart