Solved

component handle in other process

Posted on 2000-03-16
10
152 Views
Last Modified: 2010-04-04
Hi,

I create 2 applications A and B.
In A, I want to get the handle of a component (TEdit for example) on B.

What's the way to do that please?
0
Comment
Question by:Alphomega
[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
  • 3
  • 2
  • 2
  • +2
10 Comments
 
LVL 6

Expert Comment

by:Stuart_Johnson
ID: 2625943
Listening...
0
 

Expert Comment

by:kser
ID: 2626838
 I think, you don't need the Delphi component's handle, but instead you want to get a component's window handle to use it within PostMessage/SendMessage functions. Am I right ?
0
 
LVL 20

Expert Comment

by:Madshi
ID: 2626876
Alphomega, what do you know of the TEdit component? Do you have it's window handle? Or what do you have?
0
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!

 
LVL 17

Expert Comment

by:inthe
ID: 2626899
Hi,
there are a few ways i see to help this one i use ,in app b give the form a unique name as in "SomeUniqueNameForm" and give your components unique names also as in "HelloThereStuartButton".
this then gives a classname of  "TSomeUniqueNameForm" and the button a classname of "THelloThereStuartButton"

so now in app1 you can do

var
h : thandle;
begin
h := findwindow('TSomeUniqueNameForm','either the forms caption with string quotes or nil without string quotes here');
h := FindWindowEx(h,0,'THelloThereStuartButton',nil);
if h<>0 then
 begin
       {to click the button if found}
  sendmessage(h,WM_LBUTTONDOWN,0,0);
  sendmessage(h,WM_LBUTTONUP,0,0);
 end
else showmessage('couldnt find button');
end;


there are other ways using callbacks but as long as the classnames are unique and you are creating app1 and app2 above should be just fine..

Regards Barry
0
 
LVL 17

Expert Comment

by:inthe
ID: 2626902
THelloThereMadshiButton.Click;
0
 
LVL 20

Expert Comment

by:Madshi
ID: 2626910
THelloBarry.Grin;
0
 
LVL 6

Expert Comment

by:Stuart_Johnson
ID: 2627287
TG'dayBarry.Mate;
0
 

Author Comment

by:Alphomega
ID: 2629379
InThe is right.
In fact, I want to create a component to send and to receive different informations as integer, single, pointer, string, etc.
So, I can create a procedure message in a form and send data with WM_COPYDATA. But If I want to create a component to realize this and reuse in many apps, I need to know the handle component in the receiving app.So FindWindowEx is the good solution. Like this I do the work one tume only.
I accept his good response.
Thanks to all ...
0
 
LVL 17

Accepted Solution

by:
inthe earned 100 total points
ID: 2630041
cheers ;-)
0
 

Author Comment

by:Alphomega
ID: 2630922
Thanks for your help.
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

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…
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…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

734 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