Solved

Get the specific handle form TCurrencyEdit on another program

Posted on 2006-10-20
3
285 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Printing problem 2 91
RESTRequest Parameter 4 30
Twebbrowser in Fire monkey android scrolling to bottom 1 29
Delphi problems to abort a printjob 9 19
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

776 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