Re: Com Interop QueryInterface

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



>--IntPtr unknownIntPtr = Marshal.GetIUnknownForObject(cnt); //cnt is
>the com component

If cnt is a control derived from AxHost, you should use cnt.GetOcx()
to get to the real ActiveX object.

But why are you using GetIUnknownForObejct and explicit
QueryInterface? What are you going to do with the returned interface
poitner? Why not just cast to the interface?


Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
.