471,350 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,350 software developers and data experts.

Dyn loaded files and owner status window

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.

Jan 5 '06 #1
6 1350
GTi wrote:
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

Jan 5 '06 #2
GTi
agree

Jan 5 '06 #3
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
"Jon Skeet [C# MVP]" wrote:
GTi wrote:
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

Jan 5 '06 #4
GTi

Jon Skeet [C# MVP] wrote:
GTi wrote:
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


Do you have any good samples for this?

Jan 9 '06 #5
GTi

Jon Skeet [C# MVP] wrote:
GTi wrote:
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


Do you have any good samples for this?

Jan 9 '06 #6
GTi
Jon Skeet [C# MVP] wrote:
GTi wrote:
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


Do you have any samples of how this is done?

Jan 9 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by dan glenn | last post: by
9 posts views Thread by Deepa | last post: by
1 post views Thread by Sam Wuebben | last post: by
12 posts views Thread by Mark Anderson | last post: by
3 posts views Thread by Steve Teeples | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.