Solved

Get the specific handle form TCurrencyEdit on another program

Posted on 2006-10-20
3
288 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

731 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