Share via


IClassFactory

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

Because this interface contains two methods intended to deal with an entire class of objects, it is implemented on the class object for a specific class of objects, identified by a class identifier (CLSID).

When to Implement

You must implement this interface for every class that you register in the system registry and to which you assign a CLSID, so objects of that class can be created.

When to Use

After calling the CoGetClassObject function to get an IClassFactory interface pointer to the class object, call the CreateInstance method of this interface to create a new uninitialized object.

It is not, however, always necessary to go through this process to create an object. To create a single uninitialized object, you can, instead, just call the CoCreateInstance function.

OLE also provides numerous helper functions (with names of the form OleCreateXXX) to create compound document objects.

Call the LockServer method to keep the object server in memory and enhance performance only if you intend to create more than one object of the specified class.

Methods

The following table shows the methods for this interface in alphabetical order.

Method Description

CreateInstance

Creates an uninitialized object of a specified class identifier (CLSID).

LockServer

Locks an object application open in memory.

This allows new objects to be created more quickly.

Remarks

To determine whether the platform supports this interface, see Determining Supported COM APIs.

Requirements

Header ocidl.h, ocidl.idl
Library ole32.lib, uuid.lib
Windows Embedded CE Windows CE 2.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

CoCreateInstance
CoGetClassObject
IClassFactory::CreateInstance
IClassFactory::LockServer