![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5
![]() |
Getting a reference to an application
I need to get a reference to the application, without using Win32 API calls.
Currently I am executing an assembly like so: [php]a = Assembly.LoadFrom(assembly); Type[] mytypes = a.GetTypes(); foreach(Type t in mytypes) { Object obj = Activator.CreateInstance(t); }[/php] Here I specify which assembly and then activate it, I can then get the Form, and get the children (controls) or whatever else. Q1) I need to get a running instance of the application though, how can I get a reference or a handle to it without using Win32 API calls. Q2) If that's not possible, can I do it with Win32 API calls and still use .NET Reflection?
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for." -- Socrates |
|
|
|
|
|
#2 |
|
Troll
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4
![]() |
You can use an AppDomain for running an assembly, I believe. However, that would probably require some form of IPC to communicate between the two AppDomains. It isn't possible as far as I know for inter-domain references...there are some app domain methods, but I don't think they would be all too useful.
More info on your requirements might help.
__________________
MD5(sig) = bcef75433db02e9ad9bf81d6f7c5c270 |
|
|
|
|
|
#3 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5
![]() |
Well, I have to be able to read and set controls (properties) (non-standard controls, like *Janus controls too). It's for a test tool, currently we are using test tools that use the Win32 API, but we'd like to do it differently. We do make the application we test of course ourself, so we are thinking about using .NET remoting where I'll make a remoting server and one function gets added to the application that has to be tested, so the test tool can than communicate with the application that has to be tested. We don't want to put a whole bunch of extra code in the application though, but calling one function is not a big problem. I rather not put any extra function calls in the application's code, so that's why I ask.
Thanks for helping. *Janus GridEX Control is not based on a grid control but on an edit control. That is one of the problems of the current test tools. Using those tools is no option.
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for." -- Socrates |
|
|
|
|
|
#4 |
|
Troll
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4
![]() |
Testing eh? Considered NUnit? Very nice package.
Remoting is a pain, let's leave it at that. I understand you don't want to add code to the application, but an #ifdef or two can keep your NUnit test fixtures out of the final product.
__________________
MD5(sig) = bcef75433db02e9ad9bf81d6f7c5c270 |
|
|
|
|
|
#5 | |
|
Programming Guru
![]() Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5
![]() |
Quote:
![]() I just need to be able to do .NET reflection with a program that's already running.
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for." -- Socrates |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|