Solved

handle of editfield and button

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses
Course of the Month7 days, 7 hours left to enroll

632 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