diff --git a/KeyGenerator.cpp b/KeyGenerator.cpp index 91b6af3..5ab87c1 100644 --- a/KeyGenerator.cpp +++ b/KeyGenerator.cpp @@ -56,9 +56,9 @@ CKeyGeneratorApp::InitInstance( void) { // CommonControls initialize INITCOMMONCONTROLSEX InitCtrls ; - InitCtrls.dwSize = sizeof(InitCtrls) ; + InitCtrls.dwSize = sizeof( InitCtrls) ; InitCtrls.dwICC = ICC_WIN95_CLASSES ; - InitCommonControlsEx(&InitCtrls) ; + InitCommonControlsEx( &InitCtrls) ; CWinApp::InitInstance() ; @@ -85,8 +85,10 @@ CKeyGeneratorApp::InitInstance( void) // verifico la protezione SetLockType( KEY_LOCK_TYPE_HW) ; string sKey = GetPrivateProfileStringUtf8( "General", "Key", "", m_pszProfileName) ; - if ( VerifyKey( sKey, 823, 16, 10) != KEY_OK) + if ( VerifyKey( sKey, 823, 16, 10) != KEY_OK) { + m_nExitCode = 1 ; return FALSE ; + } // gestione linea di comando int nFlag = 0 ; @@ -102,9 +104,18 @@ CKeyGeneratorApp::InitInstance( void) dlg.DoModal() ; // Per uscire dall'applicazione + m_nExitCode = 0 ; return FALSE ; } +//---------------------------------------------------------------------------- +int +CKeyGeneratorApp::ExitInstance( void) +{ + CWinApp::ExitInstance() ; + return m_nExitCode ; +} + //---------------------------------------------------------------------------- string GetExeNameVer( void) diff --git a/KeyGenerator.h b/KeyGenerator.h index 3602c9d..95c5739 100644 --- a/KeyGenerator.h +++ b/KeyGenerator.h @@ -27,9 +27,13 @@ class CKeyGeneratorApp : public CWinApp CKeyGeneratorApp( void) ; public : - virtual BOOL InitInstance( void) ; + BOOL InitInstance( void) override ; + int ExitInstance( void) override ; DECLARE_MESSAGE_MAP() + + private : + int m_nExitCode ; } ; //---------------------------------------------------------------------------- diff --git a/KeyGenerator.rc b/KeyGenerator.rc index 80da151..df972df 100644 Binary files a/KeyGenerator.rc and b/KeyGenerator.rc differ