ComWrappers.GetOrCreateObjectForComInstance 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| 名稱 | Description |
|---|---|
| GetOrCreateObjectForComInstance(IntPtr, CreateObjectFlags) |
取得目前註冊的受管理物件,或建立新的受管理物件並註冊。 |
| GetOrCreateObjectForComInstance(IntPtr, CreateObjectFlags, Object) |
取得目前註冊的受管理物件,或建立新的受管理物件並註冊。 |
GetOrCreateObjectForComInstance(IntPtr, CreateObjectFlags)
取得目前註冊的受管理物件,或建立新的受管理物件並註冊。
public:
System::Object ^ GetOrCreateObjectForComInstance(IntPtr externalComObject, System::Runtime::InteropServices::CreateObjectFlags flags);
public object GetOrCreateObjectForComInstance(IntPtr externalComObject, System.Runtime.InteropServices.CreateObjectFlags flags);
member this.GetOrCreateObjectForComInstance : nativeint * System.Runtime.InteropServices.CreateObjectFlags -> obj
Public Function GetOrCreateObjectForComInstance (externalComObject As IntPtr, flags As CreateObjectFlags) As Object
參數
- externalComObject
-
IntPtr
nativeint
物件用來匯入 .NET 執行時使用。
- flags
- CreateObjectFlags
用來描述外部物件的旗幟。
傳回
一個與所提供外部 COM 物件相關聯的受管理物件。
備註
如果先前透過此ComWrappers實例為指定externalComObject物件建立受管理物件,則該物件將被回傳。 如果沒有,就會再建立一個新的。
適用於
GetOrCreateObjectForComInstance(IntPtr, CreateObjectFlags, Object)
取得目前註冊的受管理物件,或建立新的受管理物件並註冊。
public:
System::Object ^ GetOrCreateObjectForComInstance(IntPtr externalComObject, System::Runtime::InteropServices::CreateObjectFlags flags, System::Object ^ userState);
public object GetOrCreateObjectForComInstance(IntPtr externalComObject, System.Runtime.InteropServices.CreateObjectFlags flags, object? userState);
member this.GetOrCreateObjectForComInstance : nativeint * System.Runtime.InteropServices.CreateObjectFlags * obj -> obj
Public Function GetOrCreateObjectForComInstance (externalComObject As IntPtr, flags As CreateObjectFlags, userState As Object) As Object
參數
- externalComObject
-
IntPtr
nativeint
要匯入並用於 .NET 執行時的物件。
- flags
- CreateObjectFlags
一個描述外部物件的列舉值的位元組合。
- userState
- Object
一個用來幫助建立包裝 .NET 物件的狀態物件。
傳回
回傳與所提供外部 COM 物件相關的受管理物件。
備註
如果先前使用此ComWrappers實例為指定externalComObject物件建立過受管理物件,則會回傳先前建立的物件。 如果沒有,就會建立新的。