The FINDREPLACE structure contains information that the FindText and ReplaceText functions use to initialize the Find and Replace common dialog boxes. The FINDMSGSTRING registered message uses this structure to pass the user's search or replacement input to the owner window of a Find or Replace common dialog box.
typedef struct { // fr
DWORD lStructSize;
HWND hwndOwner;
HINSTANCE hInstance;
DWORD Flags;
LPTSTR lpstrFindWhat;
LPTSTR lpstrReplaceWith;
WORD wFindWhatLen;
WORD wReplaceWithLen;
LPARAM lCustData;
LPFRHOOKPROC lpfnHook;
LPCTSTR lpTemplateName;
} FINDREPLACE;
Members
lStructSize
Specifies the length, in bytes, of the structure.
hwndOwner
Identifies the window that owns the dialog box. The window procedure of the specified window receives FINDMSGSTRING messages from the dialog box. This member can be any valid window handle, but it must not be NULL.
hInstance
If the FR_ENABLETEMPLATEHANDLE flag is set in the Flags member, hInstance is the handle of a memory object containing a dialog box template. If the FR_ENABLETEMPLATE flag is set, hInstance identifies a module that contains a dialog box template named by the lpTemplateName member. If neither flag is set, this member is ignored.
Flags
A set of bit flags that you can use to initialize the dialog box. The dialog box sets these flags when it sends the FINDMSGSTRING registered message to indicate the user's input. This member can be a combination of the following flags:
Flag | Meaning | ||||
FR_DIALOGTERM | |||||
If set in a FINDMSGSTRING message, indicates that the dialog box is closing. When you receive a message with this flag set, the dialog box window handle returned by the FindText or ReplaceText function is no longer valid. | |||||
FR_DOWN | |||||
If set, the Down button of the direction radio buttons in a Find dialog box is selected indicating that you should search from the current location to the end of the document. If not set, the Up button is selected so you should search to the beginning of the document. You can set this flag to initialize the dialog box. If set in a FINDMSGSTRING message, indicates the user's selection. | |||||
FR_ENABLEHOOK | |||||
Enables the hook function specified in the lpfnHook member. This flag is used only to initialize the dialog box. | |||||
FR_ENABLETEMPLATE | |||||
Indicates that the hInstance and lpTemplateName members specify a dialog box template to use in place of the default template. This flag is used only to initialize the dialog box. | |||||
FR_ENABLETEMPLATEHANDLE | |||||
Indicates that the hInstance member identifies a data block that contains a preloaded dialog box template. The system ignores the lpTemplateName member if this flag is specified. | |||||
FR_FINDNEXT | |||||
If set in a FINDMSGSTRING message, indicates that the user clicked the Find Next button in a Find or Replace dialog box. The lpstrFindWhat member specifies the string to search for. | |||||
FR_HIDEUPDOWN | |||||
If set when initializing a Find dialog box, hides the search direction radio buttons. | |||||
FR_HIDEMATCHCASE | |||||
If set when initializing a Find or Replace dialog box, hides the Match Case check box. | |||||
FR_HIDEWHOLEWORD | |||||
If set when initializing a Find or Replace dialog box, hides the Match Whole Word Only check box. | |||||
FR_MATCHCASE | |||||
If set, the Match Case check box is checked indicating that the search should be case-sensitive. If not set, the check box is unchecked so the search should be case-insensitive. You can set this flag to initialize the dialog box. If set in a FINDMSGSTRING message, indicates the user's selection. | |||||
FR_NOMATCHCASE | |||||
If set when initializing a Find or Replace dialog box, disables the Match Case check box. | |||||
FR_NOUPDOWN | |||||
If set when initializing a Find dialog box, disables the search direction radio buttons. | |||||
FR_NOWHOLEWORD | |||||
If set when initializing a Find or Replace dialog box, disables the Whole Word check box. | |||||
FR_REPLACE | |||||
If set in a FINDMSGSTRING message, indicates that the user clicked the Replace button in a Replace dialog box. The lpstrFindWhat member specifies the string to be replaced and the lpstrReplaceWith member specifies the replacement string. | |||||
FR_REPLACEALL | |||||
If set in a FINDMSGSTRING message, indicates that the user clicked the Replace All button in a Replace dialog box. The lpstrFindWhat member specifies the string to be replaced and the lpstrReplaceWith member specifies the replacement string. | |||||
FR_SHOWHELP | |||||
Causes the dialog box to display the Help button. The hwndOwner member must specify the window to receive the HELPMSGSTRING registered messages that the dialog box sends when the user clicks the Help button. | |||||
FR_WHOLEWORD | |||||
If set, the Match Whole Word Only check box is checked indicating that you should search only for whole words that match the search string. If not set, the check box is unchecked so you should also search for word fragments that match the search string. You can set this flag to initialize the dialog box. If set in a FINDMSGSTRING message, indicates the user's selection. |
lpstrFindWhat
Pointer to a buffer that a FINDMSGSTRING message uses to pass the null terminated search string that the user typed in the "Find What:" edit control. You must dynamically allocate the buffer or use a global or static array so it does not go out of scope before the dialog box closes. The buffer should be at least 80 characters long. If the buffer contains a string when you initialize the dialog box, the string is displayed in the "Find What:" edit control.
If a FINDMSGSTRING message specifies the FR_FINDNEXT flag, lpstrFindWhat contains the string to search for. The FR_DOWN, FR_WHOLEWORD, and FR_MATCHCASE flags indicate the direction and type of search. If a FINDMSGSTRING message specifies the FR_REPLACE or FR_REPLACE flags, lpstrFindWhat contains the string to be replaced.
lpstrReplaceWith
Pointer to a buffer that a FINDMSGSTRING message uses to pass the null terminated replacement string that the user typed in the "Replace With:" edit control. You must dynamically allocate the buffer or use a global or static array so it does not go out of scope before the dialog box closes. If the buffer contains a string when you initialize the dialog box, the string is displayed in the "Replace With:" edit control.
If a FINDMSGSTRING message specifies the FR_REPLACE or FR_REPLACEALL flags, lpstrReplaceWith contains the replacement string .
The FindText function ignores this member.
wFindWhatLen
Specifies the length, in bytes, of the buffer pointed to by the lpstrFindWhat member.
wReplaceWithLen
Specifies the length, in bytes, of the buffer pointed to by the lpstrReplaceWith member.
lCustData
Specifies application-defined data that the system passes to the hook procedure identified by the lpfnHook member. When the system sends the WM_INITDIALOG message to the hook procedure, the message's lParam parameter is a pointer to the FINDREPLACE structure specified when the dialog was created. The hook procedure can use this pointer to get the lCustData value.
lpfnHook
Pointer to an FRHookProc hook procedure that can process messages intended for the dialog box. This member is ignored unless the FR_ENABLEHOOK flag is set in the Flags member.
If the hook procedure returns FALSE in response to the WM_INITDIALOG message, the hook procedure must display the dialog box or else the dialog box will not be shown. To do this, first perform any other paint operations, and then call the ShowWindow and UpdateWindow functions.
lpTemplateName
Pointer to a null-terminated string that names the dialog box template resource in the module identified by the hInstance member. This template is substituted for the standard dialog box template. For numbered dialog box resources, this can be a value returned by the MAKEINTRESOURCE macro. This member is ignored unless the FR_ENABLETEMPLATE flag is set in the Flags member.
See Also
FindText, FRHookProc, MAKEINTRESOURCE, ReplaceText, ShowWindow, UpdateWindow, WM_INITDIALOG