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.
 
Back
Top