HB_BOOL hb_oleAxInit( void ) { hb_oleInit(); if( s_hLib == NULL ) { PHB_AX_WININIT pAtlAxWinInit; s_hLib = hbwapi_LoadLibrarySystem( TEXT( "atl.dll" ) ); if( ( unsigned long ) ( HB_PTRDIFF ) s_hLib <= 32 ) { s_hLib = NULL; return HB_FALSE; } pAtlAxWinInit = ( PHB_AX_WININIT ) HB_WINAPI_GETPROCADDRESS( s_hLib, "AtlAxWinInit" ); s_pAtlAxGetControl = ( PHB_AX_GETCTRL ) HB_WINAPI_GETPROCADDRESS( s_hLib, "AtlAxGetControl" ); if( pAtlAxWinInit ) ( *pAtlAxWinInit )(); hb_vmAtQuit( hb_oleAxExit, NULL ); } return HB_TRUE; }
BOOL WINAPI DllMain( HINSTANCE hInstance, DWORD dwReason, PVOID pvReserved ) #endif { static HB_BOOL s_fInit = HB_FALSE; BOOL fResult = TRUE; HB_SYMBOL_UNUSED( pvReserved ); switch( dwReason ) { case DLL_PROCESS_ATTACH: s_hInstDll = ( HINSTANCE ) hInstance; s_lLockCount = s_lObjectCount = 0; s_IClassFactoryObj.lpVtbl = ( IClassFactoryVtbl * ) &IClassFactory_Vtbl; DisableThreadLibraryCalls( ( HMODULE ) hInstance ); s_fInit = ! hb_vmIsActive(); if( s_fInit ) hb_vmInit( HB_FALSE ); hb_oleInit(); if( ! s_fServerReady ) { PHB_DYNS pDynSym = hb_dynsymFind( "DLLMAIN" ); if( pDynSym && hb_dynsymIsFunction( pDynSym ) && hb_vmRequestReenter() ) { hb_vmPushDynSym( pDynSym ); hb_vmPushNil(); hb_vmProc( 0 ); hb_vmRequestRestore(); } } fResult = s_fServerReady ? TRUE : FALSE; break; case DLL_PROCESS_DETACH: s_fServerReady = HB_FALSE; if( s_pAction ) { hb_itemRelease( s_pAction ); s_pAction = NULL; } if( s_pMsgHash ) { hb_itemRelease( s_pMsgHash ); s_pMsgHash = NULL; } if( s_fInit ) { hb_vmQuit(); s_fInit = HB_FALSE; } break; } return fResult; }