Solved

handle of editfield and button

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

914 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

20 Experts available now in Live!

Get 1:1 Help Now