Files
TestEGr/TestEGr.cpp
T

127 lines
3.6 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2013-2014
//----------------------------------------------------------------------------
// File : TestEGr.cpp Data : 29.01.14 Versione : 1.5a1
// 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/EGnDllMain.h"
#include "/EgtDev/Include/EgnGetModuleVer.h"
#include "/EgtDev/Include/EGnStringConverter.h"
#include "/EgtDev/Include/EgtIniFile.h"
#include "/EgtDev/Include/EgtLogger.h"
#include <fstream>
//----------------------------------------------------------------------------
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
//--------------------------- Define -----------------------------------------
#if defined( _WIN64)
#if defined( NDEBUG)
#define STR_EXE "TestEGrR64.exe"
#else
#define STR_EXE "TestEGrD64.exe"
#endif
#elif defined( _WIN32)
#if defined( NDEBUG)
#define STR_EXE "TestEGrR32.exe"
#else
#define STR_EXE "TestEGrD32.exe"
#endif
#endif
using namespace std ;
using namespace egtlogger ;
//----------------------------------------------------------------------------
// 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( sDir) ;
// costruisco path file INI
string sFileIni= sDir + "\\TestEGr.ini" ;
wchar_t* p = _wcsdup( stringtoW( sFileIni)) ;
free( (void*) m_pszProfileName) ;
m_pszProfileName = p ;
// livello di debug
int nDebug = GetPrivateProfileInt( "General", "Debug", 0, m_pszProfileName) ;
// inizializzazioni del logger
Logger logger( ( nDebug > 0 ? LL_DEBUG : LL_INFO), "TestEGr") ;
logger.AddOutputStream( new ofstream( "TestEgr.log"), true) ;
// inizio programma
LOG_DATETIME( &logger, " Start")
// versione del programma
LOG_INFO( &logger, GetExeNameVer().c_str())
// versione delle librerie
LOG_INFO( &logger, GetEGnVersion())
//LOG_INFO( &logger, GetENkVersion())
//LOG_INFO( &logger, GetEGkVersion())
// Dialog interface
CTestEGrDlg dlg ;
m_pMainWnd = &dlg ;
dlg.DoModal() ;
// fine programma
LOG_DATETIME( &logger, " End")
// Exit application with FALSE
return FALSE ;
}
//----------------------------------------------------------------------------
string
GetExeNameVer( void)
{
string sVer ;
GetModuleVersion( NULL, sVer) ;
return string( STR_EXE " ver." + sVer) ;
}