RegistrationServices.RegisterTypeForComClients 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將指定的類型註冊給 COM。
多載
| 名稱 | Description |
|---|---|
| RegisterTypeForComClients(Type, Guid) |
使用指定的 GUID 向 COM 註冊指定型別。 |
| RegisterTypeForComClients(Type, RegistrationClassContext, RegistrationConnectionType) |
利用指定的執行上下文與連線類型,將指定型別登錄給 COM。 |
備註
請注意,使用 Platform Invoke 呼叫未管理 CoRegisterClassObject 物件及 CoDisconnectObject COM 物件的註冊與取消註冊方法並不支援。
RegisterTypeForComClients(Type, Guid)
使用指定的 GUID 向 COM 註冊指定型別。
public:
virtual void RegisterTypeForComClients(Type ^ type, Guid % g);
public virtual void RegisterTypeForComClients(Type type, ref Guid g);
[System.Security.SecurityCritical]
public virtual void RegisterTypeForComClients(Type type, ref Guid g);
abstract member RegisterTypeForComClients : Type * Guid -> unit
override this.RegisterTypeForComClients : Type * Guid -> unit
[<System.Security.SecurityCritical>]
abstract member RegisterTypeForComClients : Type * Guid -> unit
override this.RegisterTypeForComClients : Type * Guid -> unit
Public Overridable Sub RegisterTypeForComClients (type As Type, ByRef g As Guid)
參數
實作
- 屬性
例外狀況
參數 type 為 null。
type參數無法被建立。
備註
此方法相當於在 COM 中呼叫 CoRegisterClassObject 。 此 RegisterTypeForComClients 方法非原子式,且在多執行緒環境中使用時可能導致不可預測的結果。
在 2.0 版本及更新版本中,使用 UnregisterTypeForComClients 該方法在 COM 中取消註冊型別。
請注意,使用 Platform Invoke 呼叫未管理 CoRegisterClassObject 物件及 CoDisconnectObject COM 物件的註冊與取消註冊方法並不支援。
另請參閱
適用於
RegisterTypeForComClients(Type, RegistrationClassContext, RegistrationConnectionType)
利用指定的執行上下文與連線類型,將指定型別登錄給 COM。
public:
virtual int RegisterTypeForComClients(Type ^ type, System::Runtime::InteropServices::RegistrationClassContext classContext, System::Runtime::InteropServices::RegistrationConnectionType flags);
[System.Runtime.InteropServices.ComVisible(false)]
public virtual int RegisterTypeForComClients(Type type, System.Runtime.InteropServices.RegistrationClassContext classContext, System.Runtime.InteropServices.RegistrationConnectionType flags);
[System.Runtime.InteropServices.ComVisible(false)]
[System.Security.SecurityCritical]
public virtual int RegisterTypeForComClients(Type type, System.Runtime.InteropServices.RegistrationClassContext classContext, System.Runtime.InteropServices.RegistrationConnectionType flags);
[<System.Runtime.InteropServices.ComVisible(false)>]
abstract member RegisterTypeForComClients : Type * System.Runtime.InteropServices.RegistrationClassContext * System.Runtime.InteropServices.RegistrationConnectionType -> int
override this.RegisterTypeForComClients : Type * System.Runtime.InteropServices.RegistrationClassContext * System.Runtime.InteropServices.RegistrationConnectionType -> int
[<System.Runtime.InteropServices.ComVisible(false)>]
[<System.Security.SecurityCritical>]
abstract member RegisterTypeForComClients : Type * System.Runtime.InteropServices.RegistrationClassContext * System.Runtime.InteropServices.RegistrationConnectionType -> int
override this.RegisterTypeForComClients : Type * System.Runtime.InteropServices.RegistrationClassContext * System.Runtime.InteropServices.RegistrationConnectionType -> int
Public Overridable Function RegisterTypeForComClients (type As Type, classContext As RegistrationClassContext, flags As RegistrationConnectionType) As Integer
參數
- classContext
- RegistrationClassContext
RegistrationClassContext其中一個值表示執行檔將執行的上下文。
其中一個 RegistrationConnectionType 值是指定如何與類別物件建立連結的。
傳回
一個代表 cookie 值的整數。
- 屬性
例外狀況
參數 type 為 null。
type參數無法被建立。
備註
此方法相當於在 COM 中呼叫 CoRegisterClassObject 。 此 RegisterTypeForComClients 方法非原子式,且在多執行緒環境中使用時可能導致不可預測的結果。
在 .NET Framework 2.0 及更新版本中,使用 UnregisterTypeForComClients 方法來取消 COM 中的型別註冊。
請注意,使用 Platform Invoke 呼叫未管理 CoRegisterClassObject 物件及 CoDisconnectObject COM 物件的註冊與取消註冊方法並不支援。