Solved

handle of editfield and button

Posted on 2000-04-26
4
176 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
[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
  • 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

Independent Software Vendors: 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

Suggested Solutions

Title # Comments Views Activity
Making delphi communicate with a c# service 16 140
tidtcpserver connection lost handle 2 124
Tidtcpserver listening on multiports? 1 57
Firemonkey BASS_Init into a thread 17 88
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…
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…
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…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

710 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