This section describes the steps you must take to make your Microsoft® DirectShow objects self-registering. It describes the relationships between the registry entry points called by OLE, the globally-defined CFactoryTemplate array elements, and the AMOVIESETUP_MEDIATYPE, AMOVIESETUP_PIN, and AMOVIESETUP_FILTER structures.
To enable objects in a dynamic-link library (DLL) to register themselves, two OLE-defined entry points must be provided in the DLL and exported:
With these entry points in your DLL, you can use the Regsvr32.exe tool to register and unregister your DLL or setup tools, or applications can register the filter programmatically.
Implementing Self-Registration
To implement a self-registering filter, carry out the following steps.
STDAPI DllRegisterServer() { return AMovieDllRegisterServer2(TRUE); } HRESULT DllUnregisterServer() { return AMovieDllRegisterServer2(FALSE); }
You can add code to these functions to set up custom registry entries.
For example, here are the structures for the Ball.ax sample filter:
// Setup data const AMOVIESETUP_MEDIATYPE sudOpPinTypes = { &MEDIATYPE_Video , &MEDIASUBTYPE_NULL }; const AMOVIESETUP_PIN sudOpPin = { L"Output" , FALSE , TRUE , FALSE , FALSE , &CLSID_NULL , NULL , 1 , &sudOpPinTypes }; const AMOVIESETUP_FILTER sudBallax = { &CLSID_BouncingBall , L"Bouncing Ball" , MERIT_UNLIKELY , 1 , &sudOpPin };
CFactoryTemplate gTemplates[]={ L"Bouncing Ball", // Name of the filter &CLSID_BouncingBall, // CLSID of the filter CBouncingBall::CreateInstance, // Static function to be called by class factory NULL, // &sudBallax} // Address of the AMOVIESETUP_FILTER structure };
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.