> Thanks for your help!
>
[quoted text clipped - 92 lines]
>
> - Show quoted text -
Klaus,
First of all, it doesnt not seem like your MFC app is a managed
aplpication. Do you compile it with /clr command line option?
If you are using only MFC, why do you need to build a managed
application?
Secondly, do you have the method MyExample() overridden in
CMyBaseDerived?
Thirdly, assuming you have MyExample() overridden in CMyBaseDerived,
dont you have to cast PMyBase to a pointer to the derived object?
Virtual method references are resolved at run time, so unless the
machine knows the object is of derived type, it would look for the
method's definition ion the base class (
http://www.parashift.com/c++-faq-lite/virtual-functions.html#faq-20.3
).. and if you dont have an implementation of MyExample() in the base
class, you will get an access violation.. no matter in managed/
unmanaged code.
Pardon me if I missed something.
Klaus - 03 Aug 2007 11:23 GMT
Hi,
The MFC App is pure unmanaged, built with VC 6.0!
MyExample() must be overriden in CMyBaseDerived, otherwise it could not be
instantiated.
From my understanding, I do not have to cast the pointer to the derived
class in order to call MyExample; this is exactly why the concept of virtual
methods was introduced; your web reference states nothing else.
Don't forget, everything works fine in the main thread!
So, from my point of view it is more a "security issue" in managed code
preventing me from calling unsecure code?
Best regards,
Klaus
Pixel.to.life - 03 Aug 2007 17:29 GMT
> Hi,
>
[quoted text clipped - 11 lines]
> Best regards,
> Klaus
Klaus,
Then I did not understand your problem properly, my apologies.
Good luck with it.
Pixel.To.Life.