//---------------------------------------------------------------------------- // EgalTech 2014-2019 //---------------------------------------------------------------------------- // File : TestEGr.cpp Data : 18.01.19 Versione : 2.1a2 // Contenuto : Implementazione della classe applicazione test grafica. // // // // Modifiche : 29.01.14 DS Creazione modulo. // // //---------------------------------------------------------------------------- //--------------------------- Include ---------------------------------------- #include "stdafx.h" #include "TestEGr.h" #include "TestEGrDlg.h" #include "/EgtDev/Include/EInAPI.h" #include "/EgtDev/Include/EGnGetModuleVer.h" #include "/EgtDev/Include/EgtStringConverter.h" #include "/EgtDev/Include/EgtIniFile.h" //---------------------------------------------------------------------------- #ifdef _DEBUG #define new DEBUG_NEW #endif //--------------------------- Define ----------------------------------------- #if defined( _WIN64) && defined( NDEBUG) #define STR_EXE "TestEGrR64.exe" #elif defined( _WIN64) #define STR_EXE "TestEGrD64.exe" #elif defined( _WIN32) && defined( NDEBUG) #define STR_EXE "TestEGrR32.exe" #else #define STR_EXE "TestEGrD32.exe" #endif using namespace std ; //---------------------------------------------------------------------------- // The one and only CTestEGrApp object CTestEGrApp theApp ; //---------------------------------------------------------------------------- BEGIN_MESSAGE_MAP( CTestEGrApp, CWinApp) ON_COMMAND( ID_HELP, &CWinApp::OnHelp) END_MESSAGE_MAP() //---------------------------------------------------------------------------- CTestEGrApp::CTestEGrApp( void) { } //---------------------------------------------------------------------------- BOOL CTestEGrApp::InitInstance( void) { // CommonControls initialize INITCOMMONCONTROLSEX InitCtrls ; InitCtrls.dwSize = sizeof( InitCtrls) ; InitCtrls.dwICC = ICC_WIN95_CLASSES ; InitCommonControlsEx( &InitCtrls) ; CWinApp::InitInstance() ; AfxEnableControlContainer() ; // recupero il direttorio del programma e lo imposto come corrente string sDir ; GetModuleDirectory( NULL, sDir) ; SetCurrentDirectory( stringtoW( sDir)) ; // costruisco path file INI string sFileIni= sDir + "\\TestEGr.ini" ; wchar_t* p = _wcsdup( stringtoW( sFileIni)) ; free( (void*) m_pszProfileName) ; m_pszProfileName = p ; // imposto chiave di protezione string sKey = GetPrivateProfileStringUtf8( "General", "Key", "", m_pszProfileName) ; EgtSetKey( stringtoW( sKey)) ; // inizializzo int nDebug = GetPrivateProfileInt( "General", "Debug", 0, m_pszProfileName) ; string sMsg = GetExeNameVer() ; EgtInit( nDebug, L"TestEgr.log", stringtoW( sMsg)) ; // inizializzo il font manager string sNfeFontDir = GetPrivateProfileStringUtf8( "GeomDB", "NfeFontDir", "", m_pszProfileName) ; string sDefaultFont = GetPrivateProfileStringUtf8( "GeomDB", "DefaultFont", "", m_pszProfileName) ; EgtSetFont( stringtoW( sNfeFontDir), stringtoW( sDefaultFont)) ; // imposto dir di default per libreria Lua e lancio libreria di base string sLuaLibsDir = GetPrivateProfileStringUtf8( "Lua", "LibsDir", "", m_pszProfileName) ; EgtSetLuaLibs( stringtoW( sLuaLibsDir)) ; string sLuaBaseLib = GetPrivateProfileStringUtf8( "Lua", "BaseLib", "EgtBase", m_pszProfileName) ; EgtLuaRequire( stringtoW( sLuaBaseLib)) ; // imposto logger dei comandi EgtSetCommandLogger( L"TestEgr.tua") ; // gestione linea di comando string sFileToOpen ; CCommandLineInfo cmdInfo ; ParseCommandLine( cmdInfo) ; if ( cmdInfo.m_nShellCommand == CCommandLineInfo::FileOpen) sFileToOpen = WtoA( cmdInfo.m_strFileName) ; // Dialog interface CTestEGrDlg dlg( sFileToOpen, nullptr, nullptr) ; m_pMainWnd = &dlg ; dlg.DoModal() ; // fine programma EgtExit() ; // Exit application with FALSE return FALSE ; } //---------------------------------------------------------------------------- string GetExeNameVer( void) { string sVer ; GetModuleVersion( NULL, sVer) ; return string( STR_EXE " ver." + sVer) ; }