Marshal.QueryInterface(IntPtr, Guid, IntPtr) 메서드

정의

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);
[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
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
static member QueryInterface : nativeint * Guid * nativeint -> int
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

이 메서드는 반환될 때 반환된 인터페이스에 대한 참조를 포함합니다.

반환

Int32

호출의 성공이나 실패를 나타내는 HRESULT입니다.

특성

설명

이 메서드는 QueryInterface 특정 인터페이스 포인터를 가져오려고 시도하는 COM 개체의 IUnknown::QueryInterface 메서드를 노출합니다. COM 개체에서 사용하는 QueryInterface 것은 관리 코드에서 캐스트 작업을 수행하는 것과 같습니다. 이 메서드를 사용하여 개체를 호출하면 포인터가 반환되기 전에 인터페이스 포인터에서 참조 수가 증가합니다. 포인터를 완료한 후에는 항상 참조 수를 감소하는 데 사용합니다 Marshal.Release . IUnknown 인터페이스 포인터를 나타내는 값을 얻으려면 IntPtr 호출Marshal.GetComInterfaceForObjectMarshal.GetIUnknownForObject하거나 Marshal.GetIDispatchForObject호출할 수 있습니다.

적용 대상

추가 정보