RegistrationServices.RegisterTypeForComClients 方法

定義

向 COM 註冊指定的型別。

多載

RegisterTypeForComClients(Type, Guid)

使用指定的 GUID 來註冊 COM 的特定型別。

RegisterTypeForComClients(Type, RegistrationClassContext, RegistrationConnectionType)

使用指定的執行內容和連接類型,向 COM 註冊指定的型別。

備註

請注意,不支援使用平臺叫用來呼叫 Unmanaged CoRegisterClassObjectCoDisconnectObject 方法進行 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
Type

要登錄以便從 COM 使用的 Type

g
Guid

用來登錄指定型別的 Guid

實作

屬性

例外狀況

type 參數為 null

無法建立 type 參數。

備註

這個方法相當於在 COM 中呼叫 CoRegisterClassObject 。 方法 RegisterTypeForComClients 不是不可部分完成的,而且在多線程內容中使用時可能會導致無法預測的結果。

在 2.0 版和更新版本中,使用 UnregisterTypeForComClients 方法來取消註冊 COM 中的類型。

請注意,不支援使用平臺叫用來呼叫 Unmanaged CoRegisterClassObjectCoDisconnectObject 方法進行 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

參數

type
Type

要登錄以便從 COM 使用的 Type 物件。

classContext
RegistrationClassContext

其中一個 RegistrationClassContext 值,表示可執行程式碼將在其中執行的內容。

flags
RegistrationConnectionType

其中一個 RegistrationConnectionType 值,指定如何與類別物件進行連接。

傳回

整數,表示 Cookie 值。

屬性

例外狀況

type 參數為 null

無法建立 type 參數。

備註

這個方法相當於在 COM 中呼叫 CoRegisterClassObject 。 方法 RegisterTypeForComClients 不是不可部分完成的,而且在多線程內容中使用時可能會導致無法預測的結果。

在 .NET Framework 2.0 版和更新版本中,使用 UnregisterTypeForComClients 方法來取消註冊 COM 中的類型。

請注意,不支援使用平臺叫用來呼叫 Unmanaged CoRegisterClassObjectCoDisconnectObject 方法進行 COM 物件的註冊和取消管理。

適用於