Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sourcecode of the Find/Replace text dialog box 1

Status
Not open for further replies.

SYN

Programmer
Nov 2, 2000
45
NL
Hi,

I'm looking for the (vfp) source-code of the find/replace text dialog box (from comdlg32)

Thanks in advance.


 
AirCon,

thanks for the url. I tried this but the replace function isn't defined here. I know there is also a replacetext-function in comdlg32. Do you know anything about this or another way to use these funtions?

Regards
 
SYN

For the replace it is called ReplaceText. Declare it the same way as FindText.

Declare Long ReplaceText in ComDlg32 String @lpFR

The lpFR structure also the same with FindText. You can work this out from FindText example

Regards

-- AirCon --
 
AirCon,

I can't make it work (because I'm not familiar with api-calls) I simply replaced the findtext with replacetext. Isn't that enough?

*.* hwndFind = FindText (@lcFindReplace)
hwndFind = ReplaceText (@lcFindReplace)

*.* DECLARE INTEGER FindText IN comdlg32 STRING @ lpfr
DECLARE INTEGER ReplaceText IN comdlg32 STRING @ lpfr

Regards
 
I think you need a little more than that

typedef struct {
DWORD lStructSize;
HWND hwndOwner;
HINSTANCE hInstance;
DWORD Flags;
LPTSTR lpstrFindWhat;
LPTSTR lpstrReplaceWith;
WORD wFindWhatLen;
WORD wReplaceWithLen;
LPARAM lCustData;
LPFRHOOKPROC lpfnHook;
LPCTSTR lpTemplateName;
} FINDREPLACE, *LPFINDREPLACE;

FindText only need to fill in lpstrFindWhat and wFindWhatLen.
ReplaceText also needs to fill lpstrReplaceWith and wReplaceWithLen.

Now, I never use this function. So I have no idea yet. But one thing that suspicious to me is, maybe (just maybe) you also need to define a callback procedure for this function to work cos it sends an internal message to the caller. And do the "actual replacement" in the callback procedure. If my guess is true, then you can't work this from VFP directly. But I hope it's wrong :)

Regards

-- AirCon --
 
I'll try this.
But do you know what function is used to find/repl in a text editor? The menu is english and I'm looking for a dialog in the user-language. I thougth the ReplaceText would be the best one. Do you have other suggestions?

 
SYN

I already tried ReplaceText. I think I'm right. It only display the find & replace windows, but it doesn't do the "actual replacement". You're gonna need a wrapper for this (callback function)

Another idea is to create your own dialog. You can use FileToStr() function. Search the text using AT() and do a string concatenation using SUBSTR() etc. It's not very hard to do (I think) :)

-- AirCon --
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top