How to display a message from a .NET dll when it is loaded into a program written by another develop

  • Thread starter Thread starter David T.
  • Start date Start date
D

David T.

When a library user runs their exe I want the dll to display a message. How
can this be done?
Thanks in advance.
 
David,

What you need is two assemblies. The first is one that you know will
always be loaded. This will cycle through the app domains in a process, and
hook up to the AssemblyLoad event.

Then, when you handle the event, you need to identify your assembly
somehow (a custom attribute would be perfect here). If it is indeed your
assembly, then you would show the message.

You should make sure that you are not running in a server environment
though, as this kind of message being thrown up by a library would really
put a crimp on things (no interactive session is enabled, and it would just
hang really).

Hope this helps.
 
Thank you.

I think what I really need is access to a pre-wired event that is raised
while a component is loading. I want to execute code before any code is
executed. This can be done with COM can probably also be done from .NET.

Is there an equivalent to the OnLoad event


Nicholas Paldino said:
David,

What you need is two assemblies. The first is one that you know will
always be loaded. This will cycle through the app domains in a process,
and hook up to the AssemblyLoad event.

Then, when you handle the event, you need to identify your assembly
somehow (a custom attribute would be perfect here). If it is indeed your
assembly, then you would show the message.

You should make sure that you are not running in a server environment
though, as this kind of message being thrown up by a library would really
put a crimp on things (no interactive session is enabled, and it would
just hang really).

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

David T. said:
When a library user runs their exe I want the dll to display a message.
How can this be done?
Thanks in advance.
 
Back
Top