REGCLS

The REGCLS enumeration defines values used in CoRegisterClassObject to control the type of connections to a class object. It is defined as follows:

typedef enum tagREGCLS 
{ 
    REGCLS_SINGLEUSE         = 0, 
    REGCLS_MULTIPLEUSE       = 1, 
    REGCLS_MULTI_SEPARATE    = 2, 
    REGCLS_SUSPENDED         = 4, 
    REGCLS_SURROGATE         = 8, 
} REGCLS; 
 

Elements

REGCLS_SINGLEUSE
Once an application is connected to a class object with CoGetClassObject, the class object is removed from public view so that no other applications can connect to it. This value is commonly used for single document interface (SDI) applications. Specifying this value does not affect the responsibility of the object application to call CoRevokeClassObject; it must always call CoRevokeClassObject when it is finished with an object class.
REGCLS_MULTIPLEUSE
Multiple applications can connect to the class object through calls to CoGetClassObject. If both the REGCLS_MULTIPLEUSE and CLSCTX_LOCAL_SERVER are set in a call to CoRegisterClassObject, the class object is also automatically registered as an in-process server, whether or not CLSCTX_INPROC_SERVER is explicitly set.
REGCLS_MULTI_SEPARATE
Useful for registering separate CLSCTX_LOCAL_SERVER and CLSCTX_INPROC_SERVER class factories through calls to CoGetClassObject. If REGCLS_MULTI_SEPARATE is set, each execution context must be set separately: CoRegisterClassObject does not automatically register an out-of-process server (for which CLSCTX_LOCAL_SERVER is set) as an in-process server. This allows the EXE to create multiple instances of the object for in-process needs, such as self embeddings, without disturbing its CLSCTX_LOCAL_SERVER registration. If an EXE registers a REGCLS_MULTI_SEPARATE class factory and a CLSCTX_INPROC_SERVER class factory, instance creation calls that specify CLSCTX_INPROC_SERVER in the CLSCTX parameter executed by the EXE would be satisfied locally without approaching SCM. This mechanism is useful when the EXE uses functions such as OleCreate and OleLoad to create embeddings, but at the same does not wish to launch a new instance of itself for the self-embedding case. The distinction is important for embeddings because the default handler aggregates the Proxy Manager by default and the application should override this default behavior by calling OleCreateEmbeddingHelper for the self-embedding case.

If your application need not distinguish between the local and inproc case, you need not register your class factory using REGCLS_MULTI_SEPARATE. In fact, the application incurs an extra network round trip to SCM when it registers its MULTIPLEUSE class factory as MULTI_SEPARATE and does not register another class factory as INPROC_SERVER.

REGCLS_SUSPENDED
Suspends registration and activation requests for the specified CLSID until there is a call to CoResumeClassObjects. This is used typically to register the CLSIDs for servers that can register multiple class objects to reduce the overall registration time, and thus the server application startup time, by making a single call to the SCM, no matter how many CLSIDs are registered for the server.
REGCLS_SURROGATE
The class object is a surrogate process used to run DLL servers. The class factory registered by the surrogate process is not the actual class factory implemented by the DLL server, but a generic class factory implemented by the surrogate. This generic class factory delegates instance creation and marshaling to the class factory of the DLL server running in the surrogate. For further information on DLL Surrogates, see the DllSurrogate registry named-value.

Remarks

In CoRegisterClassObject, members of both the REGCLS and the CLSCTX enumerations, taken together, determine how the class object is registered.

An EXE surrogate (in which DLL servers are run) calls CoRegisterClassObject to register a class factory using a new REGCLS value, REGCLS_SURROGATE.

The following table summarizes the allowable REGCLS value combinations and the object registrations affected by the combinations.


REGCLS_
SINGLEUSE

REGCLS_
MULTIPLEUSE
REGCLS_
MULTI_
SEPARATE


Other
CLSCTX_
INPROC_
SERVER
Error In-process In-process Error
CLSCTX_
LOCAL_
SERVER
Local In-process/ local Local Error
Both of the above Error In-process/ local In-process/ local Error
Other Error Error Error Error

All class factories for dll surrogates should be registered with REGCLS_SURROGATE set. Do not set REGCLS_SINGLUSE or REGCLS_MULTIPLEUSE when you register a surrogate for DLL servers.

QuickInfo

  Windows NT: Use version 3.1 and later.
  Windows: Use Windows 95 and later.
  Windows CE: Unsupported.
  Header: Declared in objbase.h.

See Also

CoGetClassObject, CoRegisterClassObject, CoRevokeClassObject, DllGetClassObject, DllSurrogate