共用方式為


CFindReplaceDialog Class

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

class CFindReplaceDialog : public CCommonDialog

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 call any of the member functions listed in the "Operations" section of the See Also

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.

Requirements

Header: afxdlgs.h

Smart Device Developer Notes

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.

See Also

Concepts

CFindReplaceDialog Members

CCommonDialog Class

Hierarchy Chart