Solved

handle of editfield and button

Posted on 2000-04-26
4
166 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

706 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

17 Experts available now in Live!

Get 1:1 Help Now