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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

EM_FINDTEXT in Delphi, Undeclared error

Status
Not open for further replies.

phpl

Programmer
May 16, 2004
3
0
0
CA
I'm using Delphi 6.

This is regarding sending API commands in delphi!

I am wondering why "EM_FINDTEXT" causes an error in delphi. "EM_SETSEL" does not cause an error, and other "EM_"'s and "WM_"'s work. I can only get certain "EM_"s to work.

EM_FINDTEXT causes the following error in Delphi:
[Error] Unit1.pas(154): Undeclared identifier: 'EM_FINDTEXT'

I looked up "EM_FINDTEXT on google..I found code snippets that other people had written, but no information as to why I would be getting the error. Am I missing a "uses" or a delphi unit?


Sample example (simple) code, just for testing.

//Selects some specified characters in NOTEPAD
procedure TForm1.Button2Click(Sender: TObject);
var
handle: HWND;
begin
handle:=3036; //handle of the edit box
SendMessage(handle, EM_SETSEL,1,5);

end;

procedure TForm1.Button2Click(Sender: TObject);
var
handle: HWND;
begin
handle:=3036; //handle of the edit box, found using a spy program
SendMessage(handle, EM_FINDTEXT,0,0);
end;

end.

Thank you.
phpl
 
In the above code I meant button1click, sorry for the confusion.

In other words, I am having problems with the following code:

//this below works with no errors
procedure TForm1.Button1Click(Sender: TObject);
var
handle: HWND;
begin
handle:=3036; //handle of the edit box
SendMessage(handle, EM_SETSEL,1,5);

end;

//this below does not work and causes undeclared identifier message on "EM_FINDTEXT"

procedure TForm1.Button2Click(Sender: TObject);
var
handle: HWND;
begin
handle:=3036; //handle of the edit box, found using a spy program
SendMessage(handle, EM_FINDTEXT,0,0);
end;
 
All right, I put in "RichEdit" in my Uses clause and that solved the problem.

Sorry for responding to myself and solving my own problem - maybe it will be of help to someone else searching the internet though.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top