CFactoryTemplate Class (Windows CE 5.0)
This class provides a template used by the default class factory code.
Create one CFactoryTemplate object in an array for every object class so that the default class factory code can create new instances.
This class holds the name of the object, the object's class identifier (CLSID), and a pointer to the creation function for the corresponding object.
Initialize one of these in an array called g_Templates for each CLSID the application's DLL supports.
The creation function should take an LPUNKNOWN parameter and an HRESULT pointer and return an object derived from the CBaseObject class.
Set the HRESULT to a failed value if there is any error in construction.
An example declaration (from the Gargle sample filter) follows.
// list of class ids and creator functions for class factory
CFactoryTemplate g_Templates[2]=
{ { L"Gargle filter" // CFactoryTemplate.m_name
, &CLSID_Gargle // CFactoryTemplate.m_ClsID
, CGargle::CreateInstance // CFactoryTemplate.m_lpfnNew
, NULL // CFactoryTemplate.m_lpfnInit
, &sudGargle // CFactoryTemplate.m_pAMovieSetup_Filter
}
, { L"Gargle filter property page"
, &CLSID_GargProp
, CGargleProperties::CreateInstance
}
};
int g_cTemplates = sizeof(g_Templates) / sizeof(g_Templates[0]);
Note that the name of the object is strictly necessary only if you are using the DllRegisterServer setup routine to implement self-registering of your filter.
If you are not using this feature, you can set the first element of the g_Templates instance (m_Name) to NULL or L"".
Protected Data Members
Member | Description |
---|---|
m_ClsID | Pointer to the CLSID of the object class. |
m_lpfnNew | Pointer to a function that creates an instance of the object class. |
m_lpfnInit | Pointer to a function that initializes a new instance of the object class. |
m_Name | Name of the filter; required when using filter self-registration services. |
m_pAMovieSetup_Filter | Pointer to an AMOVIESETUP_FILTER structure; required when using filter self-registration services. |
Member Functions
Member function | Description |
---|---|
CreateInstance | Calls the object-creation function for the class. |
IsClassID | Determines whether a CLSID matches this class template. |
Requirements
DirectShow applications and DirectShow filters have different include file and link library requirements.
For more information, see Setting Up the Build Environment.
OS Versions: Windows CE 2.12 and later. Version 2.12 requires DXPAK 1.0 or later.
Header:
Send Feedback on this topic to the authors