IClassFactory
The IClassFactory
interface contains two methods intended to deal with an entire class of
objects, and so is implemented on the class object for a specific class of
objects (identified by a CLSID). The first method, CreateInstance,
creates an uninitialized object of a specified CLSID, and the second, LockServer,
locks the object s server in memory, allowing new objects to be created more
quickly.
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
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
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 in Vtable Order
IUnknown Methods |
Description |
QueryInterface |
Returns
pointers to supported interfaces. |
AddRef |
Increments
reference count. |
Release |
Decrements
reference count. |
IClassFactory
Methods |
Description |
CreateInstance |
Creates an
uninitialized object. |
LockServer |
Locks
object application open in memory. |
See Also