RegistrationServices.RegisterTypeForComClients 方法

定义

向 COM 注册指定类型。

重载

名称 说明
RegisterTypeForComClients(Type, Guid)

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

RegisterTypeForComClients(Type, RegistrationClassContext, RegistrationConnectionType)

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

注解

请注意,不支持使用平台调用调用非托管 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
Type

Type要从 COM 注册以供使用。

g
Guid

Guid用于注册指定类型。

实现

属性

例外

参数 typenull.

type无法创建参数。

注解

此方法等效于在 COM 中调用 CoRegisterClassObject 。 该方法 RegisterTypeForComClients 不是原子方法,在多线程上下文中使用时可能会导致不可预知的结果。

在版本 2.0 及更高版本中,使用 UnregisterTypeForComClients 该方法在 COM 中注销类型。

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

参数

type
Type

Type要从 COM 注册以供使用的对象。

classContext
RegistrationClassContext

指示 RegistrationClassContext 将运行可执行代码的上下文的值之一。

flags
RegistrationConnectionType

指定 RegistrationConnectionType 如何建立与类对象的连接的值之一。

返回

一个表示 Cookie 值的整数。

属性

例外

参数 typenull.

type无法创建参数。

注解

此方法等效于在 COM 中调用 CoRegisterClassObject 。 该方法 RegisterTypeForComClients 不是原子方法,在多线程上下文中使用时可能会导致不可预知的结果。

在 .NET Framework 版本 2.0 及更高版本中,使用 UnregisterTypeForComClients 方法在 COM 中注销类型。

请注意,不支持使用平台调用调用非托管 CoRegisterClassObject 对象以及 CoDisconnectObject 用于注册和取消管理 COM 对象的方法。

适用于