Find/Replace Dialog Functions
These functions display standard dialog boxes for find and replace operations.
FindText
The FindText
function displays a system-defined Find dialog box.
UINT FindText(
LPFINDREPLACE lpfr
);
Parameters
Parameter | Type | Description |
---|---|---|
lpfr |
LPFINDREPLACE | A pointer to a FINDREPLACE structure that contains information that the dialog box needs to initialize its controls. This parameter can be NULL. |
Return Value
If the function succeeds, the return value is a nonzero value. If the user clicks the Cancel button or an error occurs, the return value is 0.
Remarks
The FindText
function displays a modal dialog box. The application creates and displays the dialog box by calling the FindText
function. When the user clicks the Find Next button, the dialog box is destroyed, and the function returns a nonzero value. If the user clicks the Cancel button, the dialog box is destroyed, and the function returns 0.
FindText
, you must link with Comdlg32.lib.
ReplaceText
The ReplaceText
function displays a system-defined Replace dialog box.
UINT ReplaceText(
LPFINDREPLACE lpfr
);
Parameters
Parameter | Type | Description |
---|---|---|
lpfr |
LPFINDREPLACE | A pointer to a FINDREPLACE structure that contains information that the dialog box needs to initialize its controls. This parameter can be NULL. |
Return Value
If the function succeeds, the return value is a nonzero value. If the user clicks the Cancel button or an error occurs, the return value is 0.
Remarks
The ReplaceText
function displays a modal dialog box. The application creates and displays the dialog box by calling the ReplaceText
function. When the user clicks the Replace or Replace All button, the dialog box is destroyed, and the function returns a nonzero value. If the user clicks the Cancel button, the dialog box is destroyed, and the function returns 0.
ReplaceText
, you must link with Comdlg32.lib.
FINDREPLACE Structure
The FINDREPLACE
structure contains information used by the FindText
and ReplaceText
functions to initialize the Find and Replace dialog boxes. It also contains information that the functions return to the application.
typedef struct tagFINDREPLACE {
DWORD lStructSize;
HWND hwndOwner;
HINSTANCE hInstance;
DWORD Flags;
LPSTR lpstrFindWhat;
LPSTR lpstrReplaceWith;
WORD wFindWhatLen;
WORD wReplaceWithLen;
LPARAM lCustData;
LPFRHOOKPROC lpfnHook;
LPCSTR lpTemplateName;
} FINDREPLACE, *LPFINDREPLACE;
Members
Member | Type | Description |
---|---|---|
lStructSize |
DWORD | The size, in bytes, of this structure. |
hwndOwner |
HWND | A handle to the owner window of the dialog box. This member can be NULL. |
hInstance |
HINSTANCE | A handle to the instance of the module that contains the template used to create the dialog box. This member is used only if the FR_ENABLETEMPLATE flag is set in the Flags member. |
Flags |
DWORD | A set of bit flags that can be used to customize the dialog box. Possible values include:
|
lpstrFindWhat |
LPSTR | A pointer to the null-terminated string that specifies the text to search for. |
lpstrReplaceWith |
LPSTR | A pointer to the null-terminated string that specifies the text to replace the found text with. This member is used only if the FR_REPLACE or FR_REPLACEALL flag is set in the Flags member. |
wFindWhatLen |
WORD | The size, in characters, of the buffer pointed to by lpstrFindWhat . |
wReplaceWithLen |
WORD | The size, in characters, of the buffer pointed to by lpstrReplaceWith . |
lCustData |
LPARAM | Application-defined data that the dialog box procedure should pass to the system when processing the WM_INITDIALOG message. |
lpfnHook |
LPFRHOOKPROC | A pointer to a dialog box procedure that customizes the dialog box. The dialog box procedure must have the same convention as a DialogProc function. |
lpTemplateName |
LPCSTR | A pointer to a null-terminated string that specifies the resource name of the template to be copied. This member is used only if the FR_ENABLETEMPLATE flag is set in the Flags member. |