Christopher
Mon Apr 19 13:33:44 CDT 2004
Hi,
You might be able to create a mixed mode DLL in Managed C++ and implement
the DllMain.
The following articles describe som issues regarding mixed mode DLL's.
http://support.microsoft.com/default.aspx?scid=kb;en-us;814472
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vcconMixedDLLLoadingProblem.asp
Chris
"localhost" <primpilus@cohort.ces> wrote in message
news:i5r780drl6fqpf1vdcu4eh2fvubqmq1s4k@4ax.com...
>
> You have misunderstood my question.
>
> I have a .NET .dll. I have a .NET executable. When the .NET
> executable is run, I the LoadFrom method in the Reflection class can
> be used to load the dll. I want to know if the dll can detect when it
> is loaded and inspected. I hope the dll has some kind of event that
> is fired when it is loaded. Is that possible?
>
> As far as I know, the dll can only "do something" when a class inside
> it is instanced and the constructor fires. I am hoping there is an
> alternative (I don't want to apply a class factory pattern if I don't
> have to, but I will).
>
> Thanks.
>
>
>
> On Thu, 05 Feb 2004 03:48:37 GMT, timhuang@online.microsoft.com (Tian
> Min Huang) wrote:
>
> >Hello,
> >
> >Thanks for your post. As I understand, you want to detect whether a .NET
> >class is instantiated from managed or unmanaged client. Please correct me
> >if there is any misunderstanding. I'd like to share the following
> >information with you:
> >
> >As you know, a managed class is always created on .NET side. That is,
> >unmanaged client cannot access your managed component directly, it should
> >call through CCW (COM callable wrappers) instead. Please refer to the
> >following MSDN article for detailed information on CCW:
> >
> >Calling a .NET Component from a COM Component
>
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/h
t
> >ml/callnetfrcom.asp
> >
> >One method comes up to my mind so far is that: In the constructor of your
> >managed class, throw and catch an exception so that you can get the call
> >stack, look up the call stack that will help you determine where the call
> >is originated from. I am afraid that there is no easy way.
> >
> >Please feel free to let me know if you have any problems or concerns.
> >
> >Have a nice day!
> >
> >Regards,
> >
> >HuangTM
> >Microsoft Online Partner Support
> >MCSE/MCSD
> >
> >Get Secure! -- www.microsoft.com/security
> >This posting is provided "as is" with no warranties and confers no
rights.
>