com pntr to interop ___gc: how ?????

  • Thread starter Thread starter Jim G
  • Start date Start date
J

Jim G

How do you set an interop managed class instance to an
actual com created instance.

why doesn't this work????

CComPtr<IHTMLDocument2> spDoc;

mshtml::IHTMLDocument2* doc=(mshtml::IHTMLDocument2*)
spDoc.p;

Thank you for your help
 
Off the top of my head, can you use

System::Object *pObject =
System::Runtime::InteropServices::Marshal::GetObjectForIUnknown(spDoc.GetInt
erfacePtr())

and then cast that to your managed interface pointer?

I haven't tested it but it might get you started.
 
Stu,

Thank you, you gave me just what i needed.

Good Luck to you and yours!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top