This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can trysigning in orchanging directories.
Access to this page requires authorization. You can trychanging directories.
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Requests a pointer to a specified interface from a COM object.
public: static int QueryInterface(IntPtr pUnk, Guid % iid, [Runtime::InteropServices::Out] IntPtr % ppv);
[System.Security.SecurityCritical]public static int QueryInterface(IntPtr pUnk, ref Guid iid, out IntPtr ppv);
public static int QueryInterface(IntPtr pUnk, in Guid iid, out IntPtr ppv);
[System.Runtime.Versioning.SupportedOSPlatform("windows")]public static int QueryInterface(IntPtr pUnk, ref Guid iid, out IntPtr ppv);
public static int QueryInterface(IntPtr pUnk, ref Guid iid, out IntPtr ppv);
[<System.Security.SecurityCritical>]static member QueryInterface : nativeint * Guid * nativeint -> int
static member QueryInterface : nativeint * Guid * nativeint -> int
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]static member QueryInterface : nativeint * Guid * nativeint -> int
Public Shared Function QueryInterface (pUnk As IntPtr, ByRef iid As Guid, ByRef ppv As IntPtr) As Integer
nativeint
The interface to be queried.
The interface identifier (IID) of the requested interface.
nativeint
When this method returns, contains a reference to the returned interface.
An HRESULT that indicates the success or failure of the call.
TheQueryInterface method exposes theIUnknown::QueryInterface method of a COM object, which attempts to obtain a specific interface pointer. UsingQueryInterface
on a COM object is the same as performing a cast operation in managed code. Calling an object with this method causes the reference count to increment on the interface pointer before the pointer is returned. Always useMarshal.Release to decrement the reference count once you have finished with the pointer. To obtain anIntPtr value that represents aIUnknown interface pointer, you can callMarshal.GetComInterfaceForObject,Marshal.GetIUnknownForObject, orMarshal.GetIDispatchForObject.
Was this page helpful?
Was this page helpful?