Solved

Get the specific handle form TCurrencyEdit on another program

Posted on 2006-10-20
3
283 Views
Last Modified: 2010-04-05
How can I do to get the specific handle of TCurrencyEdit on another program?

I need this handle, to use the message WM_GETTEXT to retrieve your content.

I found many examples in the web, but all lists all the windows handles, an I need to retrieve the specific handle of TCurrencyEdit.

Any idea?
0
Comment
Question by:felipesch
  • 2
3 Comments
 
LVL 28

Assisted Solution

by:TName
TName earned 500 total points
ID: 17775144
Hi, have you tried something like this?

procedure TForm1.Button1Click(Sender: TObject);
var
hForm, hEdit :HWND;
begin
 hForm:=FindWindow(nil,'TestApp');
 if hForm<>0 then begin
   hEdit := FindWindowEx(hForm, 0, 'TCurrencyEdit', nil);
   if hEdit<>0 then
      ShowMessage('Found!');
 end;
end;

'TestApp' is of course your other's application's window title.
0
 

Author Comment

by:felipesch
ID: 17775201
Oks, but the window has 3 TCurrencyEdits! How can I know what the TCurrencyEdit Handle are returned by function?
0
 
LVL 28

Accepted Solution

by:
TName earned 500 total points
ID: 17775377
procedure TForm1.Button1Click(Sender: TObject);
var
hForm, hEdit :HWND;
len,i:Integer;
aText: String;
begin
 hForm:=FindWindow(nil,'TestApp');
 if hForm<>0 then begin
   hEdit := FindWindowEx(hForm, 0, 'TCurrencyEdit', 'CurrencyEdit2');
   if hEdit<>0 then begin
      len := SendMessage(hEdit, WM_GETTEXTLENGTH, 0, 0)+1;
      SetLength(aText,len);
      SendMessage(hEdit, WM_GETTEXT, Len, longint(aText));
      ShowMessage(aText);
     end;
 end;
end;

Where CurrencyEdit2 is the Name of the edit you_re looking for.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now