EnterpriseServicesHelper.WrapIUnknownWithComObject(IntPtr) 方法

定義

使用執行階段可呼叫包裝函式 (RCW) 來包裝指定 IUnknown COM 介面。Wraps the specified IUnknown COM interface with a Runtime Callable Wrapper (RCW).

public:
 static System::Object ^ WrapIUnknownWithComObject(IntPtr punk);
public static object WrapIUnknownWithComObject (IntPtr punk);
[System.Security.SecurityCritical]
public static object WrapIUnknownWithComObject (IntPtr punk);
static member WrapIUnknownWithComObject : nativeint -> obj
[<System.Security.SecurityCritical>]
static member WrapIUnknownWithComObject : nativeint -> obj
Public Shared Function WrapIUnknownWithComObject (punk As IntPtr) As Object

參數

punk
IntPtr

對要包裝的 IUnknown COM 介面的指標。A pointer to the IUnknown COM interface to wrap.

傳回

Object

包裝指定 IUnknown 時所在的 RCW。The RCW where the specified IUnknown is wrapped.

屬性

例外狀況

目前的呼叫端沒有 UnmanagedCode 權限。The immediate caller does not have UnmanagedCode permission.

備註

WrapIUnknownWithComObject方法類似于 Marshal.GetObjectForIUnknown 方法,但不會嘗試維護未受管理物件的身分識別。The WrapIUnknownWithComObject method is similar to the Marshal.GetObjectForIUnknown method, but does not attempt to maintain the identity of the unmanaged object. 例如,兩個與目前方法相同的呼叫會傳回 IUnknown 兩個不同的 rcw,但兩個對方法的呼叫會傳回 GetObjectForIUnknown IUnknown 相同的 rcw。For example, two calls with the same IUnknown to the current method return two different RCWs, but two calls to the GetObjectForIUnknown method with the same IUnknown return the same RCW.

適用於