Marshal.QueryInterface(IntPtr, Guid, IntPtr) メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
COM オブジェクトから指定したインターフェイスへのポインターを要求します。
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);
public static int QueryInterface(IntPtr pUnk, ref readonly 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
パラメーター
- pUnk
-
IntPtr
nativeint
クエリを実行するインターフェイス。
- iid
- Guid
要求されたインターフェイスのインターフェイス識別子 (IID)。
- ppv
-
IntPtr
nativeint
このメソッドから制御が戻るときに、返されるインターフェイスへの参照を格納します。
返品
呼び出しの成功または失敗を示す HRESULT。
- 属性
注釈
QueryInterface メソッドは、COM オブジェクトの IUnknown::QueryInterface メソッドを公開します。このメソッドは、特定のインターフェイス ポインターの取得を試みます。 COM オブジェクトで QueryInterface を使用することは、マネージド コードでキャスト操作を実行する場合と同じです。 このメソッドを使用してオブジェクトを呼び出すと、ポインターが返される前に、インターフェイス ポインターで参照カウントがインクリメントされます。 ポインターが終了したら、常に Marshal.Release を使用して参照カウントを減らします。
IUnknown インターフェイス ポインターを表すIntPtr値を取得するには、Marshal.GetComInterfaceForObject、Marshal.GetIUnknownForObject、またはMarshal.GetIDispatchForObjectを呼び出します。