Solved

component handle in other process

Posted on 2000-03-16
10
147 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
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
 
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
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.

 
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

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

867 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

21 Experts available now in Live!

Get 1:1 Help Now