RegistrationServices.RegisterTypeForComClients 方法
定义
向 COM 注册指定的类型。Registers the specified type with COM.
重载
| RegisterTypeForComClients(Type, Guid) |
使用指定的 GUID 向 COM 注册指定的类型。Registers the specified type with COM using the specified GUID. |
| RegisterTypeForComClients(Type, RegistrationClassContext, RegistrationConnectionType) |
使用指定的执行上下文和连接类型向 COM 注册指定的类型。Registers the specified type with COM using the specified execution context and connection type. |
注解
请注意,不支持使用平台调用调用非托管的 CoRegisterClassObject 和 CoDisconnectObject 用于注册和注销 COM 对象的方法。Note that using platform invoke to call the unmanaged CoRegisterClassObject and CoDisconnectObject methods for registration and unregistration of COM objects is not supported.
RegisterTypeForComClients(Type, Guid)
使用指定的 GUID 向 COM 注册指定的类型。Registers the specified type with COM using the specified GUID.
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。The type parameter is null.
无法创建 type 参数。The type parameter cannot be created.
注解
此方法等效于 CoRegisterClassObject 在 COM 中调用。This method is equivalent to calling CoRegisterClassObject in COM. RegisterTypeForComClients方法不是原子方法,在多线程上下文中使用时,可能会导致不可预测的结果。The RegisterTypeForComClients method is not atomic and can cause unpredictable results when used in a multithreaded context.
在版本2.0 及更高版本中,使用 UnregisterTypeForComClients 方法取消注册 COM 中的类型。In version 2.0 and later, use the UnregisterTypeForComClients method to unregister a type in COM.
请注意,不支持使用平台调用调用非托管的 CoRegisterClassObject 和 CoDisconnectObject 用于注册和注销 COM 对象的方法。Note that using platform invoke to call the unmanaged CoRegisterClassObject and CoDisconnectObject methods for registration and unregistration of COM objects is not supported.
另请参阅
适用于
RegisterTypeForComClients(Type, RegistrationClassContext, RegistrationConnectionType)
使用指定的执行上下文和连接类型向 COM 注册指定的类型。Registers the specified type with COM using the specified execution context and connection type.
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 值之一,指示将在其中运行可执行代码的上下文。One of the RegistrationClassContext values that indicates the context in which the executable code will be run.
RegistrationConnectionType 值之一,指定如何建立到类对象的连接。One of the RegistrationConnectionType values that specifies how connections are made to the class object.
返回
表示一个 Cookie 值的整数。An integer that represents a cookie value.
- 属性
例外
type 参数为 null。The type parameter is null.
无法创建 type 参数。The type parameter cannot be created.
注解
此方法等效于 CoRegisterClassObject 在 COM 中调用。This method is equivalent to calling CoRegisterClassObject in COM. RegisterTypeForComClients方法不是原子方法,在多线程上下文中使用时,可能会导致不可预测的结果。The RegisterTypeForComClients method is not atomic and can cause unpredictable results when used in a multithreaded context.
在 .NET Framework 版本2.0 及更高版本中,使用 UnregisterTypeForComClients 方法取消注册 COM 中的类型。In the .NET Framework version 2.0 and later, use the UnregisterTypeForComClients method to unregister a type in COM.
请注意,不支持使用平台调用调用非托管的 CoRegisterClassObject 和 CoDisconnectObject 用于注册和注销 COM 对象的方法。Note that using platform invoke to call the unmanaged CoRegisterClassObject and CoDisconnectObject methods for registration and unregistration of COM objects is not supported.