Solved

component handle in other process

Posted on 2000-03-16
10
145 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
  • 3
  • 2
  • 2
  • +2
10 Comments
 
LVL 6

Expert Comment

by:Stuart_Johnson
Comment Utility
Listening...
0
 

Expert Comment

by:kser
Comment Utility
 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
Comment Utility
Alphomega, what do you know of the TEdit component? Do you have it's window handle? Or what do you have?
0
 
LVL 17

Expert Comment

by:inthe
Comment Utility
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
Comment Utility
THelloThereMadshiButton.Click;
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 20

Expert Comment

by:Madshi
Comment Utility
THelloBarry.Grin;
0
 
LVL 6

Expert Comment

by:Stuart_Johnson
Comment Utility
TG'dayBarry.Mate;
0
 

Author Comment

by:Alphomega
Comment Utility
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
Comment Utility
cheers ;-)
0
 

Author Comment

by:Alphomega
Comment Utility
Thanks for your help.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

771 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

10 Experts available now in Live!

Get 1:1 Help Now