In the example provider component, an example showing the standard IClassFactory implementation is in stdfact.cpp. See IClassFactory in the Platform SDK.