RegistrationServices.RegisterTypeForComClients Method

Definition

Registers the specified type with COM.

Overloads

RegisterTypeForComClients(Type, Guid)

Registers the specified type with COM using the specified GUID.

RegisterTypeForComClients(Type, RegistrationClassContext, RegistrationConnectionType)

Registers the specified type with COM using the specified execution context and connection type.

Remarks

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)

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)

Parameters

type
Type

The Type to be registered for use from COM.

g
Guid

The Guid used to register the specified type.

Implements

Attributes

Exceptions

The type parameter is null.

The type parameter cannot be created.

Remarks

This method is equivalent to calling CoRegisterClassObject in COM. The RegisterTypeForComClients method is not atomic and can cause unpredictable results when used in a multithreaded context.

In version 2.0 and later, use the UnregisterTypeForComClients method to unregister a type in COM.

Note that using platform invoke to call the unmanaged CoRegisterClassObject and CoDisconnectObject methods for registration and unregistration of COM objects is not supported.

See also

Applies to

RegisterTypeForComClients(Type, RegistrationClassContext, RegistrationConnectionType)

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

Parameters

type
Type

The Type object to register for use from COM.

classContext
RegistrationClassContext

One of the RegistrationClassContext values that indicates the context in which the executable code will be run.

flags
RegistrationConnectionType

One of the RegistrationConnectionType values that specifies how connections are made to the class object.

Returns

An integer that represents a cookie value.

Attributes

Exceptions

The type parameter is null.

The type parameter cannot be created.

Remarks

This method is equivalent to calling CoRegisterClassObject in COM. The RegisterTypeForComClients method is not atomic and can cause unpredictable results when used in a multithreaded context.

In the .NET Framework version 2.0 and later, use the UnregisterTypeForComClients method to unregister a type in COM.

Note that using platform invoke to call the unmanaged CoRegisterClassObject and CoDisconnectObject methods for registration and unregistration of COM objects is not supported.

Applies to