Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 21st, 2006, 9:16 AM   #1
nnxion
Programming Guru
 
nnxion's Avatar
 
Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5 nnxion is on a distinguished road
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
nnxion is offline   Reply With Quote
Old Apr 21st, 2006, 5:58 PM   #2
Dameon
Troll
 
Dameon's Avatar
 
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4 Dameon is on a distinguished road
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
Dameon is offline   Reply With Quote
Old Apr 22nd, 2006, 6:16 AM   #3
nnxion
Programming Guru
 
nnxion's Avatar
 
Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5 nnxion is on a distinguished road
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
nnxion is offline   Reply With Quote
Old Apr 22nd, 2006, 7:00 PM   #4
Dameon
Troll
 
Dameon's Avatar
 
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4 Dameon is on a distinguished road
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
Dameon is offline   Reply With Quote
Old Apr 22nd, 2006, 7:03 PM   #5
nnxion
Programming Guru
 
nnxion's Avatar
 
Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5 nnxion is on a distinguished road
Quote:
Originally Posted by Dameon
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.
Well we already do have white box (nUnit) tests, but we like to have black box tests as well. Yeah we can add something, if it would be just a one-liner.
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
nnxion is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 1:54 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC