Dyn loaded files and owner status window

  • Thread starter Thread starter GTi
  • Start date Start date
G

GTi

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.
 
GTi said:
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.

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
 
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.
 
Jon said:
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

Do you have any good samples for this?
 
Jon said:
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

Do you have any good samples for this?
 
Jon said:
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

Do you have any samples of how this is done?
 
Back
Top