Register a DLL via COM under Windows Mobile
On Windows XP, one can register a COM DLL by using regsvr32. On Windows CE, there is a similiar tool called regsvrce.exe.
The DLL must export the following function for registration to be successful:
STDAPI DllRegisterServer()
{
return AMovieDllRegisterServer2( TRUE );
}
{
return AMovieDllRegisterServer2( FALSE );
} extern “C” BOOL WINAPI DllEntryPoint(HINSTANCE, ULONG, LPVOID);
DWORD dwReason,
LPVOID lpReserved)
{
return DllEntryPoint((HINSTANCE)(hModule), dwReason, lpReserved);
}
{
return AMovieDllRegisterServer2( TRUE );
}
STDAPI
DllUnregisterServer(){
return AMovieDllRegisterServer2( FALSE );
} extern “C” BOOL WINAPI DllEntryPoint(HINSTANCE, ULONG, LPVOID);
BOOL APIENTRY
DllMain(HANDLE hModule,DWORD dwReason,
LPVOID lpReserved)
{
return DllEntryPoint((HINSTANCE)(hModule), dwReason, lpReserved);
}
If the DLL is built in Visual Studio 2005, an export file (extension .DEF) needs to be created:
EXPORTS
DllMain PRIVATE
DllGetClassObject PRIVATE
DllCanUnloadNow PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE