Creating a File-Handler Instance in a DLL
When an application specifies your file-handler DLL or stream handler, the
system looks it up in the registry by its class identifier and loaded. The system
then calls the
DllGetClassObject function of the DLL to create an instance of the file or stream handler. The
following example (written in C++) shows how a file handler creates an
instance.
// Main DLL entry point.
STDAPI DllGetClassObject(const CLSID FAR& rclsid,
const IID FAR& riid, void FAR* FAR* ppv)
{
HRESULT hresult;
hresult = CAVIFileCF::Create(rclsid, riid, ppv);
return hresult;
}
HRESULT CAVIFileCF::Create(const CLSID FAR& rclsid,
const IID FAR& riid, void FAR* FAR* ppv)
{
// The following is the class factory creation and not an
// actual PAVIFile.
CAVIFileCF FAR* pAVIFileCF;
IUnknown FAR* pUnknown;
HRESULT hresult;
// Create the instance.
pAVIFileCF = new FAR CAVIFileCF(rclsid, &pUnknown);
if (pAVIFileCF == NULL)
return ResultFromScode(E_OUTOFMEMORY);
// Set the interface pointer.
hresult = pUnknown->QueryInterface(riid, ppv);
if (FAILED(GetScode(hresult)))
delete pAVIFileCF;
return hresult;
}
- Software for developers
-
Delphi Components
.Net Components
Software for Android Developers
- More information resources
-
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
- Databases for Amazon shops developers
-
Amazon Categories Database
Browse Nodes Database