OWLNext 7.0
Borland's Object Windows Library for the modern age
|
Since the find and replace common dialog boxes are modeless, they communicate with their parent window object by using a registered message FINDMSGSTRING.
You must write an event response function that responds to FINDMSGSTRING. That event response function takes two parameters–a WPARAM and an LPARAM–and returns an LRESULT. The LPARAM parameter contains a pointer that you must pass to the dialog box object's UpdateData member function.
After calling UpdateData, you must check for the FR_DIALOGTERM flag. The common dialog box code sets that flag when the user closes the modeless dialog box. Your event response function should then zero the dialog box object pointer because it is no longer valid. You must construct and create the dialog box object again.
As long as the FR_DIALOGTERM flag was not set, you can process the FINDMSGSTRING message by performing the actual search. This can be as simple as an edit control object's Search member function or as complicated as triggering a search of a Paradox or dBASE table.
In this example, EvFindMsg is an event response function for a registered message. EvFindMsg calls UpdateData and then checks the FR_DIALOGTERM flag. If it was not set, EvFindMsg calls another member function to perform the search.