Finding Text
This topic describes sample code that displays and manages a Find dialog box so the user can specify the parameters of a search operation. The dialog box sends messages to your window procedure so you can perform the search operation. The code for displaying and managing a Replace dialog box is similar, except that it uses the ReplaceText function to display the dialog box. The Replace dialog box also sends messages in response to user clicks on the Replace and Replace All buttons. To use the Find or Replace dialog box, you must perform three separate tasks:- Get a message identifier for the FINDMSGSTRING registered message.
- Display the dialog box.
- Process FINDMSGSTRING messages when the dialog box is open.
ZeroMemory(&fr, sizeof(FINDREPLACE)); fr.lStructSize = sizeof(FINDREPLACE); fr.hwndOwner = hwnd; fr.lpstrFindWhat = szFindWhat; fr.wFindWhatLen = 80; fr.Flags = 0; hdlg = FindText(&fr); When the dialog box is open, your main message loop must include a call to the IsDialogMessage function. Pass the window handle of the dialog box as a parameter in the IsDialogMessage call. This ensures that the dialog box correctly processes keyboard messages. To monitor messages sent from the dialog box, your window procedure must check for the FINDMSGSTRING registered message and process the values passed in the FINDREPLACE structure as in the following example: LPFINDREPLACE lpfr; if (message == uFindReplaceMsg){ // Get pointer to FINDREPLACE structure from lParam. lpfr = (LPFINDREPLACE)lParam; // If the FR_DIALOGTERM flag is set, // invalidate the handle identifying the dialog box. if (lpfr->Flags & FR_DIALOGTERM){ hdlg = NULL; return 0; } // If the FR_FINDNEXT flag is set, // call the application-defined search routine // to search for the requested string. if (lpfr->Flags & FR_FINDNEXT) SearchFile(lpfr->lpstrFindWhat, (BOOL) (lpfr->Flags & FR_DOWN), (BOOL) (lpfr->Flags & FR_MATCHCASE)); return 0; }
- Software for developers
-
Delphi Components
.Net Components
Software for Android Developers - More information resources
-
MegaDetailed.Net
Unix Manual Pages
Delphi Examples - Databases for Amazon shops developers
-
Amazon Categories Database
Browse Nodes Database