Solved

handle of editfield and button

Posted on 2000-04-26
4
169 Views
Last Modified: 2010-04-04
hi to all,

i have an app (not from me) which should
be used automatically when it is running.
This app contains one editfield, some checkboxes
and four buttons.
i want to write an app in D3, which puts in the
editfield a certain text and then presses the OK-button.
how i can get the handle of this editfield and the
ok-button ?
i know how to get the handle of this app (by findwindow).
if i would have the handle of the editfield:
the rest would be simple (transfer the text by postmessage
to the editfield).
and how can i get the handle of the ok-button
(there are four buttons in the app) ?

thanks
titz
0
Comment
Question by:titz
  • 2
  • 2
4 Comments
 
LVL 3

Expert Comment

by:shenqw
ID: 2752348
Use FindWindowEx to get the EditField and OK button's Handle.
0
 
LVL 3

Accepted Solution

by:
shenqw earned 50 total points
ID: 2752419
If you don't know the EditField's ClassName and Window name,Use WinSight32.exe to get that information. to get the button's handle use same method.

procedure TForm1.Button1Click(Sender: TObject);
var
  H1,H2:THandle;
begin
  H1:=FindWindow(nil,'Form1');
  H2:=FindWindowEx(H1,0,'TEdit','Edit1');
  SendMessage(H2,WM_SETTEXT,0,Integer(PChar('shenqw'))); //Must use Sendmessage.
end;
0
 
LVL 1

Author Comment

by:titz
ID: 2756445
hi shenqw,

this works good for the editfield, but not for the button.
but do you know what message i have to send for the button ?

or otherwise: when i press the <return>-key is the same as clicking at the button.
how can i simulate this ?
the following does not work:
sendmessage(h2,wm_settext,0,vk_return);

thanks
titz
0
 
LVL 1

Author Comment

by:titz
ID: 2756669
hi shenqw,
i found it : the problem with the button.
the points are yours !
thanks
titz
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

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…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

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