IClassFactory Interface

Enables a class of objects to be created.

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 CoCreateInstance. 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 IClassFactory interface inherits the methods of the IUnknown interface.

In addition, IClassFactory defines the following methods.

MethodDescription

CreateInstance

Creates an uninitialized object.

LockServer

Locks an object application open in memory.

 

Requirements

Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderUnknwn.h
IDLUnknwn.idl
IIDIID_IClassFactory is defined as 00000001-0000-0000-C000-000000000046

See Also

CoCreateInstance
CoGetClassObject
OleCreate

Send comments about this topic to Microsoft

Build date: 11/12/2009

Tags :


Page view tracker