Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
This function retrieves the class object from a DLL object handler or object application. DllGetClassObjectis called from within the CoGetClassObjectfunction when the class context is a DLL.
OLE does not provide this function. DLLs that support the OLE Component Object Model (COM) must implement DllGetClassObjectin OLE object handlers or DLL applications.
STDAPI DllGetClassObject( REFCLSID rclsid , REFIID riid , LPVOID * ppv );
Parameters
Return Values
This function supports the standard return values E_INVALIDARG, E_OUTOFMEMORY and E_UNEXPECTED, as well as the following:
Remarks
If a call to the CoGetClassObjectfunction finds the class object that is to be loaded in a DLL, CoGetClassObjectuses the DLL's exported DllGetClassObjectfunction.
Notes to Callers
You should not call DllGetClassObjectdirectly. When an object is defined in a DLL, CoGetClassObjectcalls the CoLoadLibraryfunction to load the DLL, which, in turn, calls DllGetClassObject.
Notes to Implementers
You need to implement DllGetClassObjectin (and export it from) DLLs that support the OLE Component Object Model.
Example
Following is an example (in C++) of an implementation of DllGetClassObject. In this example, DllGetClassObjectcreates a class object and calls its QueryInterfacemethod to retrieve a pointer to the interface requested in riid. The implementation safely releases the reference it holds to the IClassFactoryinterface because it returns a reference-counted pointer to IClassFactoryto the caller.
HRESULT_export PASCAL DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID * ppvObj) { HRESULT hres = E_OUTOFMEMORY; *ppvObj = NULL; CClassFactory *pClassFactory = new CClassFactory(rclsid); if (pClassFactory != NULL) { hRes = pClassFactory->QueryInterface(riid, ppvObj); pClassFactory->Release(); } return hRes;
Requirements
Runs On | Versions | Defined in | Include | Link to |
---|---|---|---|---|
Windows CE OS | 3.0 and later | Objbase.h | Ole232.lib |
Note This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.
See Also