RegistrationServices.RegisterTypeForComClients 方法

定义

向 COM 注册指定的类型。

重载

RegisterTypeForComClients(Type, Guid)

使用指定的 GUID 向 COM 注册指定的类型。

RegisterTypeForComClients(Type, RegistrationClassContext, RegistrationConnectionType)

使用指定的执行上下文和连接类型向 COM 注册指定的类型。

注解

请注意,不支持使用平台调用非托管 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 中的类型。

请注意,不支持使用平台调用非托管 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 中的类型。

请注意,不支持使用平台调用非托管 CoRegisterClassObjectCoDisconnectObject 方法来注册和取消注册 COM 对象。

适用于