// FutureChecker.cpp : Defines the class behaviors for the application. // #include "stdafx.h" #include "FutureChecker.h" #include "FutureCheckerDlg.h" #include "LogonDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CFutureCheckerApp BEGIN_MESSAGE_MAP(CFutureCheckerApp, CWinApp) //{{AFX_MSG_MAP(CFutureCheckerApp) // NOTE - the ClassWizard will add and remove mapping macros here. // DO NOT EDIT what you see in these blocks of generated code! //}}AFX_MSG ON_COMMAND(ID_HELP, CWinApp::OnHelp) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CFutureCheckerApp construction CFutureCheckerApp::CFutureCheckerApp() { // TODO: add construction code here, // Place all significant initialization in InitInstance } ///////////////////////////////////////////////////////////////////////////// // The one and only CFutureCheckerApp object CFutureCheckerApp theApp; ///////////////////////////////////////////////////////////////////////////// // CFutureCheckerApp initialization BOOL CFutureCheckerApp::InitInstance() { AfxOleInit(); AfxSocketInit(); AfxEnableControlContainer(); // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need. //#ifdef _AFXDLL // Enable3dControls(); // Call this when using MFC in a shared DLL //#else // Enable3dControlsStatic(); // Call this when linking to MFC statically //#endif /////////////////////////////////////////////////////////////////// TCHAR szFilePath[_MAX_PATH]={0,}; ::GetModuleFileName(NULL, szFilePath, _MAX_PATH); *(strrchr( szFilePath, '\\' ) + 1) = 0; strcat( szFilePath, "\\FutureConfig.ini" ); g_ConfigINI.SetINIFile( szFilePath ); g_ConfigINI.ReadConfigEnvFromINI(); /////////////////////////////////////////////////////////////////// #ifndef _DEBUG CLogonDlg logon_dlg; int nLogon = logon_dlg.DoModal(); if( nLogon != IDOK ) return FALSE; #endif /////////////////////////////////////////////////////////////////// /* CString _strFileName; CString _strDate; char szTmp[100]; _strdate( szTmp ); _strDate = szTmp; _strDate.Replace( '/', '-' ); ::GetModuleFileName(NULL, szFilePath, _MAX_PATH); *(strrchr( szFilePath, '\\' ) + 1) = 0; _strFileName.Format( "%sFutureLog_%s.log", szFilePath, _strDate ); HANDLE hFile = CreateFile(_strFileName, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) AfxMessageBox(_T("·Î±×ÆÄÀÏÀ» ¸¸µé ¼ö ¾ø½À´Ï´Ù.")); else { g_pLogFile = new CFile((int)hFile); g_pLogFile->SeekToEnd(); } */ /////////////////////////////////////////////////////////////////// CFutureCheckerDlg dlg; m_pMainWnd = &dlg; int nResponse = dlg.DoModal(); if (nResponse == IDOK) { // TODO: Place code here to handle when the dialog is // dismissed with OK } else if (nResponse == IDCANCEL) { // TODO: Place code here to handle when the dialog is // dismissed with Cancel } // Since the dialog has been closed, return FALSE so that we exit the // application, rather than start the application's message pump. return FALSE; } int CFutureCheckerApp::ExitInstance() { /////////////////////////////////////////////////////////////////// g_ConfigINI.WriteConfigEnvToINI(); /////////////////////////////////////////////////////////////////// /* if (m_bATLInited) { _Module.RevokeClassObjects(); _Module.Term(); CoUninitialize(); } */ /* if( g_pLogFile ) { g_pLogFile->Close(); delete g_pLogFile; } */ return CWinApp::ExitInstance(); } CString CFutureCheckerApp::RegReadString(HKEY hKeyName, CString strPath, CString strSubKey) { CString RegKey = ""; HKEY hKey; ::RegOpenKeyEx(hKeyName, strPath, 0, KEY_ALL_ACCESS, &hKey); DWORD dwType; DWORD dwBytes = 10240; char szBuf[10240] = {0,}; LONG lRet = ::RegQueryValueEx(hKey, strSubKey, 0, &dwType, (LPBYTE)szBuf, &dwBytes); if( lRet == ERROR_SUCCESS ) { ::RegCloseKey(hKey); RegKey = szBuf; return RegKey; } else { ::RegCloseKey(hKey); return ""; } } BOOL CFutureCheckerApp::RegWriteString(HKEY hKeyName, CString strPath, CString strSubKey, CString strValue) { HKEY hKey; ::RegCreateKeyEx(hKeyName, strPath, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, NULL); LONG lRet = ::RegSetValueEx( hKey, strSubKey, 0, REG_SZ, (const unsigned char*)(LPCTSTR)strValue, strValue.GetLength() ); if( lRet == ERROR_SUCCESS ) { ::RegCloseKey(hKey); return TRUE; } else { Message_Box( "·¹Áö½ºÆ®¸® ¾²±â½ÇÆÐ", ::GetLastError() ); ::RegCloseKey(hKey); return FALSE; } }