How to access the control object from other process ?

D

dngchn

I know the handle of object that included other process.
and I know the type of that object. (I called that type as 'TestClass').

In my code,

// I get the handle of object from other process.
Intptr knowHandle = Win32.FindWindow(........

// I want to access that object, call method or get property, so
TestClass myTest;
myTest = ????? knwonHandle ???? ; // This point is my question. How to
assign the handle to the object ?

// If the above is sucess, I can access the object as like below.
myTest.someMethod();
var tempVar = myTest.GetSomeValue();

Is it possible?
Please some advice...
 
F

Family Tree Mike

dngchn said:
I know the handle of object that included other process.
and I know the type of that object. (I called that type as 'TestClass').

In my code,

// I get the handle of object from other process.
Intptr knowHandle = Win32.FindWindow(........

// I want to access that object, call method or get property, so
TestClass myTest;
myTest = ????? knwonHandle ???? ; // This point is my question. How to
assign the handle to the object ?

// If the above is sucess, I can access the object as like below.
myTest.someMethod();
var tempVar = myTest.GetSomeValue();

Is it possible?
Please some advice...

If you have the code for the TestClass, then why do you want to access
it from another process? It seems that you should just instantiate it
in your own process.

Windows Communication Foundation may be a way to go, but you gave a very
specific problem related to your proposed solution rather than your
overall requirement. The way you have outlined the approach above, to
the best of my knowledge, cannot be done.
 
J

Jeff Johnson

I know the handle of object that included other process.
and I know the type of that object. (I called that type as 'TestClass').

In my code,

// I get the handle of object from other process.
Intptr knowHandle = Win32.FindWindow(........

// I want to access that object, call method or get property, so
TestClass myTest;
myTest = ????? knwonHandle ???? ; // This point is my question. How to
assign the handle to the object ?

// If the above is sucess, I can access the object as like below.
myTest.someMethod();
var tempVar = myTest.GetSomeValue();

Is it possible?

I'm going to go out on a limb and say No, this is not possible. Since this
object is in another process, the only hope you might have (if no specific
communication API is in place) is to send Windows messages to the control.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top