all groups > c# > january 2006 >
You're in the

c#

group:

Dyn loaded files and owner status window


Dyn loaded files and owner status window GTi
1/4/2006 11:36:37 PM
c#:
I have a main exe program that have a status window.
This exe program loads several dll files with Assembly.LoadFile.
I want now this dll files to send my exe program messages so I can
display it
on my status window.
Is there any way I can call a class in my exe program from dll files?
The dll files don't know about the exe files and the exe program that
loaded may or may not have a status window.
Re: Dyn loaded files and owner status window Jon Skeet [C# MVP]
1/5/2006 1:32:03 AM
[quoted text, click to view]

I suggest you do this using interfaces defined in another DLL -
interfaces that both your program and your DLLs know about. The easiest
way would probably be to make the classes in your DLLs implement an
interface that had an event (or set of events), and then make your main
program subscribe to those events.

Jon
Re: Dyn loaded files and owner status window GTi
1/5/2006 2:01:05 AM
agree
Re: Dyn loaded files and owner status window Paulustrious
1/5/2006 4:23:03 AM
Or quick and dirty....

Grab the handle of the window from its name (or pass it to the dll from the
exe) and then send nominated events to it. The event handler will call your
class.

Another method is to use sockets / named pipes if the calls are relatively
infrequent.
However, the 'right' solution is as Jon Skeet said, to create an
encapsulated message handler which can pass data from one object to another.
He suggests another dll with events - eminently logical. There are
alternatives including standalone exe/service talking to objects over sockets
/ named pipes / event handlers and (if you are masochistic) interrupts.
--
Paul


[quoted text, click to view]
Re: Dyn loaded files and owner status window GTi
1/8/2006 7:28:45 AM

[quoted text, click to view]

Do you have any good samples for this?
Re: Dyn loaded files and owner status window GTi
1/8/2006 7:34:45 AM

[quoted text, click to view]

Do you have any good samples for this?
Re: Dyn loaded files and owner status window GTi
1/8/2006 3:31:56 PM
[quoted text, click to view]

Do you have any samples of how this is done?
AddThis Social Bookmark Button