Files
EgtGeomKernel/EGkDllMain.cpp
T
Dario Sassi 2e4b67f9e9 EgtGeomKernel 1.6a2 :
- aggiunte GetNfeFontDir e GetDefaultFont
- modifiche a Set di ExtText
- migliorata gestione materiali
- GeomDB::Load ora può funzionare aggiungendo a DB già carico per Insert.
2015-01-14 21:54:34 +00:00

142 lines
4.1 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2013-2013
//----------------------------------------------------------------------------
// File : EGkDllMain.cpp Data : 20.11.13 Versione : 1.3a1
// Contenuto : Inizializzazione della DLL.
//
//
//
// Modifiche : 16.11.13 DS Creazione modulo.
// 21.11.13 DS Agg. GetEGkVersion.
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "DllMain.h"
#include "FontManager.h"
#include "\EgtDev\Include\EGkDllMain.h"
#include "\EgtDev\Include\EgnGetModuleVer.h"
#include "\EgtDev\Include\EgtTrace.h"
//--------------------------- Costanti ----------------------------------------
#if defined( _WIN64)
#if defined( _DEBUG)
const char* EGK_STR = "EgtGeomKernelD64.dll ver. " ;
#else
const char* EGK_STR = "EgtGeomKernelR64.dll ver. " ;
#endif
#elif defined( _WIN32)
#if defined( _DEBUG)
const char* EGK_STR = "EgtGeomKernelD32.dll ver. " ;
#else
const char* EGK_STR = "EgtGeomKernelR32.dll ver. " ;
#endif
#endif
const int STR_DIM = 40 ;
//-----------------------------------------------------------------------------
static HINSTANCE s_hModule = NULL ;
static char s_szEGkNameVer[STR_DIM] ;
//-----------------------------------------------------------------------------
extern "C" int APIENTRY
DllMain( HMODULE hModule, DWORD dwReason, LPVOID lpReserved)
{
if ( dwReason == DLL_PROCESS_ATTACH) {
// Controllo commentato per problemi con VB.NET
//#if defined( NDEBUG)
// BOOL IsDbgPresent = FALSE ;
// CheckRemoteDebuggerPresent( GetCurrentProcess(), &IsDbgPresent) ;
// if ( IsDbgPresent)
// return 0 ;
//#endif
s_hModule = hModule ;
EGT_TRACE( "EgtGeomKernel.dll Initializing!\n") ;
}
else if ( dwReason == DLL_PROCESS_DETACH) {
s_hModule = NULL ;
EGT_TRACE( "EgtGeomKernel.dll Terminating!\n") ;
}
return 1 ;
}
//-----------------------------------------------------------------------------
const char*
GetEGkVersion( void)
{
std::string sVer ;
GetModuleVersion( s_hModule, sVer) ;
sprintf_s( s_szEGkNameVer, STR_DIM, "%s%s", EGK_STR, sVer.c_str()) ;
return s_szEGkNameVer ;
}
//-----------------------------------------------------------------------------
static ILogger* s_pLogger = nullptr ;
//-----------------------------------------------------------------------------
void
SetEGkLogger( ILogger* pLogger)
{
s_pLogger = pLogger ;
}
//-----------------------------------------------------------------------------
ILogger*
GetEGkLogger( void)
{
return s_pLogger ;
}
//-----------------------------------------------------------------------------
static std::string s_sKey ;
//-----------------------------------------------------------------------------
void
SetEGkKey( const std::string& sKey)
{
s_sKey = sKey ;
}
//-----------------------------------------------------------------------------
const std::string&
GetEGkKey( void)
{
return s_sKey ;
}
//-----------------------------------------------------------------------------
void
InitFontManager( const std::string& sNfeFontDir, const std::string& sDefaultFont)
{
// recupero il font manager
FontManager& fntMgr = FontManager::GetFontManager() ;
// lo inizializzo
fntMgr.Init( sNfeFontDir, sDefaultFont) ;
}
//-----------------------------------------------------------------------------
const std::string&
GetNfeFontDir( void)
{
// recupero il font manager
FontManager& fntMgr = FontManager::GetFontManager() ;
// restituisco il dato
return fntMgr.GetNfeFontDir() ;
}
//-----------------------------------------------------------------------------
const std::string&
GetDefaultFont( void)
{
// recupero il font manager
FontManager& fntMgr = FontManager::GetFontManager() ;
// restituisco il dato
return fntMgr.GetDefaultFont() ;
}