Поделиться через


CFactoryTemplate Class

 
Microsoft DirectShow 9.0

CFactoryTemplate Class

Provides a template for creating class factories.

In Microsoft® DirectShow®, class factories are specialized using the CFactoryTemplate class, also called the factory template. Each class factory holds a pointer to a factory template. The factory template contains information about a COM object, including the object's class identifier (CLSID) and a pointer to a function that creates the object.

In your DLL, declare a global array of factory templates named g_Templates. Include one factory template for each object in the DLL. When the DllGetClassObject function makes a new class factory, it searches the array for a template with a matching CLSID. Assuming it finds one, it creates a class factory that holds a pointer to the matching template. When the client calls IClassFactory::CreateInstance, the class factory calls the instantiation function defined in the template.

For more information, see How to Create a DLL.

Requirements

**  Header:** Declared in Combase.h; include Streams.h.

**  Library:** Use Strmbase.lib (retail builds) or Strmbasd.lib (debug builds).

Public Member Variables  
m_Name Name of the filter.
m_ClsID Pointer to the CLSID of the object.
m_lpfnNew Pointer to a function that creates an instance of the object.
m_lpfnInit Pointer to a function that gets called from the DLL entry point.
m_pAMovieSetup_Filter Pointer to an AMOVIESETUP_FILTER structure.
Public Methods  
IsClassID Determines whether a CLSID matches this class template.
CreateInstance Calls the object-creation function for the class.