From 335629585765213a472ad58d8cc6681deafa4c14 Mon Sep 17 00:00:00 2001 From: mjjo Date: Sat, 20 Jul 2013 23:23:06 +0000 Subject: [PATCH] --- HookMsg/StockData.cpp | 1008 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1008 insertions(+) create mode 100644 HookMsg/StockData.cpp diff --git a/HookMsg/StockData.cpp b/HookMsg/StockData.cpp new file mode 100644 index 0000000..17c411b --- /dev/null +++ b/HookMsg/StockData.cpp @@ -0,0 +1,1008 @@ +// StockData.cpp: implementation of the CStockData class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "hookmsg.h" +#include "StockData.h" +#include "HookMsgDlg.h" + +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[]=__FILE__; +#define new DEBUG_NEW +#endif + +using std::fstream; +using std::ios; +using std::ofstream; +using std::endl; + +UINT StockDataThread( LPVOID arg ); + +//////////////////////////////////////////////////////////////////////////////// +// +CStockData::CStockData(CHookMsgDlg * pParent) +{ + m_pParent = pParent; + m_pDataPos = NULL; + m_pData = NULL; + m_pAddRepetitionCode = NULL; + m_nMaxData = 0; + + m_hWaitEventStockData = ::CreateEvent( NULL, FALSE, FALSE, NULL ); + m_hCloseEvent = ::CreateEvent( NULL, FALSE, FALSE, NULL ); + m_objStockMstm = NULL; + + m_bRunning = FALSE; + m_bThreadRun = FALSE; + m_bRunningSkip = FALSE; +} + +//////////////////////////////////////////////////////////////////////////////// +// +CStockData::~CStockData() +{ + ::CloseHandle( m_hWaitEventStockData ); + ::CloseHandle( m_hCloseEvent ); + + SAFE_DELETE( m_pDataPos ); + SAFE_DELETE( m_pData ); + SAFE_DELETE( m_pAddRepetitionCode ); +} + +//////////////////////////////////////////////////////////////////////////////// +// Thread +BOOL CStockData::Open() +{ + m_bThreadRun = TRUE; + + CWinThread* pThread = AfxBeginThread(StockDataThread, this, THREAD_PRIORITY_NORMAL, 0, CREATE_SUSPENDED); + //AssignThreadToCPU(pThread, CPU_0); + pThread->ResumeThread(); + pThread->m_bAutoDelete = TRUE; + + return TRUE; +} + +//////////////////////////////////////////////////////////////////////////////// +// Thread ½ÃÀÛ +BOOL CStockData::Start() +{ + m_bRunning = TRUE; + ::SetEvent( m_hWaitEventStockData ); + return TRUE; +} +//////////////////////////////////////////////////////////////////////////////// +// Thread Á¾·á +BOOL CStockData::Stop(bool bForce) +{ + m_bRunning = FALSE; + ::SetEvent( m_hWaitEventStockData ); + return TRUE; +} + +//////////////////////////////////////////////////////////////////////////////// +// Thread +HANDLE CStockData::Close(bool bWait) +{ + m_bThreadRun = FALSE; + + TRACE0("*** StockDataThread Thread Close step 0.\n"); + ::SetEvent( m_hWaitEventStockData ); + + // the thread is still running. + if( bWait ) + { + if(::WaitForSingleObject(m_hCloseEvent,INFINITE) == WAIT_OBJECT_0) // ¾²·¹µå Á¾·á¸¦ È®ÀÎ. + TRACE0("*** Close waitting success.\n"); + else + TRACE0("*** Close waitting failed.\n"); + } + + return m_hCloseEvent; +} + +//////////////////////////////////////////////////////////////////////////////// +// +UINT StockDataThread( LPVOID arg ) +{ + CoInitialize(NULL); + + CStockData *pStockData = (CStockData*)arg; + + try + { + // CWnd pCPValue; + // pCPValue.Attach( (HWND)(pStockData->m_pParent->m_hCPValue.m_hWnd) ); + + DWORD dwRet; + DWORD dwMilliseconds; + while( pStockData->m_bThreadRun ) + { + if( pStockData->m_bRunning ) { + dwMilliseconds = g_AppEnv.StockCheckInterval; + if( dwMilliseconds < 4000 ) { + dwMilliseconds = g_AppEnv.StockCheckInterval = 4000; + AfxMessageBox("[ȯ°æ¼³Á¤] -> [ÇöÀç°¡ ¾²·¹µå üũÁÖ±â]´Â 4000ms ÀÌ»óÀÔ´Ï´Ù.\nüũÁֱ⸦ 4000ms·Î ÀÚµ¿º¯°æÇÕ´Ï´Ù."); + } + + pStockData->m_pParent->m_hCPValue.SetWindowText("´ë±âÁß..."); + } + else { + pStockData->m_pParent->m_hCPValue.SetWindowText("¸ØÃã"); + dwMilliseconds = INFINITE; + + // ÇöÀç°¡ ±â´ÉÀ» ²ô¸é ¸ðµçÁ¾¸ñÀÇ ÇöÀç°¡±â·ÏÀ» Áö¿ò. + for( int i=0; im_nMaxData; i++ ) + pStockData->m_pData[ i ].lStockPrice = 0; + } + + TRACE1("Wait...(dwMilliseconds: 0x%X)\n", dwMilliseconds); + dwRet = ::WaitForSingleObject( pStockData->m_hWaitEventStockData, dwMilliseconds ); + if( dwRet == WAIT_OBJECT_0 && + pStockData->m_bThreadRun == FALSE ) + break; + + if( pStockData->m_bRunning ) + { + if( pStockData->m_objStockMstm == NULL ) { + TRACE("CLSID_StockMstm °´Ã¼»ý¼º...\n"); + HRESULT hr = pStockData->m_objStockMstm.CreateInstance( CLSID_StockMstm ); + if (FAILED(hr)) { + AfxMessageBox("ÇöÀç°¡ StockMstm»ý¼º ½ÇÆÐÇß½À´Ï´Ù."); + _com_issue_error( hr ); + } + } + + pStockData->m_pParent->m_hCPValue.SetWindowText("°»½ÅÁßÀÔ´Ï´Ù."); + + TRACE("°Ë»ç½ÃÀÛ.\n"); + pStockData->Running(); + TRACE("°Ë»ç¿Ï·á.\n"); + +#ifdef _DEBUG + long lCode = 4790; + STOCKDATA * pData = pStockData->GetStockData( lCode ); + if( pData ) + TRACE2("ÇöÀç°¡ : ÄÚµå(A%06d), ÇöÀç°¡(%d) \n", lCode, pData->lStockPrice); +#endif + } + } + + // pCPValue.Detach(); + } + catch( _com_error e ) + { + TRACE("CStockData::Run -> catch(_com_error)\n"); + } + catch(...) + { + TRACE("CStockData::Run -> catch(...)\n"); + } + + if( pStockData->m_objStockMstm != NULL ) { + pStockData->m_objStockMstm.Release(); + pStockData->m_objStockMstm = NULL; + } + + TRACE0("*** StockDataThread Thread Close step 1.\n"); + ::SetEvent( pStockData->m_hCloseEvent ); // ¾²·¹µå Á¾·á¸¦ È®ÀÎ. + + CoUninitialize(); + TRACE0("*** StockDataThread Thread Ended\n"); + return 0; +} + +void CStockData::Running() +{ + try + { + CString strJCode; + long i, nJCode, nLow, nHeigh; + short sCompare; + long nMergeCount; + char szMergeCode[1024]={0,}; + + STOCKDATA * pData = NULL; + long nIndex=0; + + while( nIndex=m_nMaxData) + break; + + if( m_pData[ nIndex ].cbStockType == 5 ) // 1-Àå³», 5-ÄÚ½º´Ú, 6-Á¦3½ÃÀå + { + strcat( szMergeCode, m_pData[ nIndex ].szCode ); + nMergeCount++; + } + } + + if( strlen( szMergeCode ) == 0 ) continue; + + m_objStockMstm->SetInputValue( 0, szMergeCode ); + m_objStockMstm->BlockRequest(); + + short nGetCount = m_objStockMstm->GetHeaderValue( 0 ); // 0. (short) count + for( i=0; iGetDataValue(0, i); // 0 : (string) Á¾¸ñ ÄÚµå + + nJCode = atol( (LPSTR)(LPCTSTR)strJCode.Right(6) ); + pData = GetStockData( nJCode ); + if( pData != NULL ) + { + pData->lStockPrice = (long)m_objStockMstm->GetDataValue(4, i); // 4. (long) ÇöÀç°¡. + + sCompare = (short)m_objStockMstm->GetDataValue(3, i); // 3. (short) ´ëºñ ±¸ºÐ *1:"»óÇÑ",2:"»ó½Â",3:"º¸ÇÕ",4:"ÇÏÇÑ",5:"Ç϶ô",6:"±â¼¼»óÇÑ",7:"±â¼¼»ó½Â",8:"±â¼¼ÇÏÇÑ",9:"±â¼¼Ç϶ô". + nLow = (long)m_objStockMstm->GetDataValue(6, i); // 6. (long) ¸Å¼öÈ£°¡. + nHeigh = (long)m_objStockMstm->GetDataValue(5, i); // 5. (long) ¸ÅµµÈ£°¡ + + if( nLow == 0 || sCompare == 4 ) // ¸Å¼öÈ£°¡°¡ 0 À̸é ÇÏÇÑÁ¾¸ñÀ¸·Î ÆÇ´Ü. + pData->bLowest = true; + else + pData->bLowest = false; + + if( nHeigh == 0 || sCompare == 1 ) // ¸ÅµµÈ£°¡°¡ 0 ÀÌ¸é »óÇÑÁ¾¸ñÀ¸·Î ÆÇ´Ü. + pData->bHeigest = true; + else + pData->bHeigest = false; + } + } + } + } + catch(...) + { + ::MessageBox( NULL, "ÇöÀç°¡°Ë»ç±â´ÉÀ» ¸ÖƼ¾²·¹µå¿¡¼­ Àç½ÃÀÛÇÏÁö ¸øÇß½À´Ï´Ù.\n" + "ÀÌ ¹®Á¦´Â CybosPlusÀÇ ÀÚü¹®Á¦ÀÔ´Ï´Ù.\n\n" + "ÇöÀç°¡ ±â´ÉÀ» ´Ù½Ã »ç¿ëÇϽ÷Á¸é ÇÁ·Î±×·¥À» Àç½ÇÇàÇϽʽÿÀ.", "ÇöÀç°¡ °Ë»ç", MB_TOPMOST ); + } +} +/******************************************************************************/ + +//////////////////////////////////////////////////////////////////////////////// +// +void CStockData::Initialize() +{ + try + { + HRESULT hr; + ICpStockCodePtr _objStockCode; + + hr = _objStockCode.CreateInstance( CLSID_CpStockCode ); // Á¾¸ñÄڵ庯ȯ. + if (SUCCEEDED(hr)) + { + m_nMaxData = (long)_objStockCode->GetCount(); + + // ÀüÁ¾¸ñ µ¥ÀÌÅÍ »ý¼º ¹× ÃʱâÈ­. + m_pDataPos = new long[ MAX_DATA ]; + memset( m_pDataPos, NULL, sizeof(long)*MAX_DATA ); + m_pData = new STOCKDATA[ m_nMaxData ]; + memset( m_pData, NULL, sizeof(STOCKDATA)*m_nMaxData ); + + long nCode; + CString _strJCode, _strJName; + for(int i=0; iGetData(0, i); + _strJName = (LPCSTR)(_bstr_t)_objStockCode->GetData(1, i); + + nCode = atol( (LPSTR)(LPCTSTR)_strJCode.Right(6) ); + m_pDataPos[nCode] = (long)i; + + m_pData[ i ].lCode = nCode; + strcpy( m_pData[ i ].szCode, (LPSTR)(LPCTSTR)_strJCode ); + strcpy( m_pData[ i ].szName, (LPSTR)(LPCTSTR)_strJName ); + m_pData[ i ].cbStockType = (BYTE)_objStockCode->GetData( 4, i ); // 1-Àå³», 5-ÄÚ½º´Ú, 6-Á¦3½ÃÀå + } + + _objStockCode.Release(); + + InitExclusionCodeFromRegistery(); // °ÅºÎ : ·¹Áö½ºÆ®¸®¿¡¼­ °ÅºÎÁ¾¸ñÀ» Àоî¿È. + ReadFileExclusionCodeFromFile(); // °ÅºÎ : ÆÄÀÏ¿¡¼­ °ÅºÎÁ¾¸ñ Àоî¿È. + + ReadFileSpecialCodeByPublish(); // °ø½Ã Ưº°Á¾¸ñ ¼³Á¤ÆÄÀÏ Àоî¿È. + + ReadFileManualInputCodeFromFile();// ¼öµ¿Á¾¸ñÄÚµå. + + /////////////////////////////////////////////////////////////////// + TCHAR szFilePath[_MAX_PATH]={0,}; + ::GetModuleFileName(NULL, szFilePath, _MAX_PATH); + *(strrchr( szFilePath, '\\' ) + 1) = 0; + strcat( szFilePath, "Temp_RepetitionCode.tmp" ); + Initialize_RepetitionCode( szFilePath ); + } + else + { + AfxMessageBox( "CStockData::Initialize() °´Ã¼ »ý¼º½ÇÆÐ!" ); + } + } + catch( _com_error e ) + { + AfxMessageBox( "CStockData::Initialize() Catch Error!" ); + } +} + + +//////////////////////////////////////////////////////////////////////////////// +// +BOOL CStockData::StockVerify( CString &strCode, long & _Price, BYTE & _Type ) +{ + long nIndex = atol( (LPSTR)(LPCTSTR)strCode ); + STOCKDATA * pData = GetStockData( nIndex ); + if( pData != NULL ) + { + _Price = pData->lStockPrice; + _Type = pData->cbStockType; + + if( pData->lStockPrice ) + return TRUE; + } + + return FALSE; +} +//////////////////////////////////////////////////////////////////////////////// +// +BOOL CStockData::StockVerify( long nCode, long & _Price, BYTE & _Type ) +{ + STOCKDATA * pData = GetStockData( nCode ); + if( pData != NULL ) + { + _Price = pData->lStockPrice; + _Type = pData->cbStockType; + + if( pData->lStockPrice ) + return TRUE; + } + + return FALSE; +} + +long CStockData::ReCalcPrice( long _Price, long nLevel ) +{ + // È£°¡ Àç°è»ê. + // ---------------------- + // 5000 ¹Ì¸¸ : 5¿ø. + // 5000 ~ 10000 : 10¿ø. + // 10000 ~ 50000 : 50¿ø. + // 50000 ÀÌ»ó : 100¿ø. + // ---------------------- + long lRetPrice = _Price; + + if( _Price < 5000 ) + { + lRetPrice += (5*nLevel); + } + else if( _Price >= 5000 && _Price < 10000 ) + { + lRetPrice += (10*nLevel); + } + else if( _Price >= 10000 && _Price < 50000 ) + { + lRetPrice += (50*nLevel); + } + else if( _Price >= 50000 ) + { + lRetPrice += (100*nLevel); + } + + return lRetPrice; +} + + +void CStockData::InitExclusionCodeFromRegistery() +{ + int i; + for( i=0; iRegReadString(HKEY_CURRENT_USER, + "SOFTWARE\\LimmSoft\\TKRRDR\\RejectList\\", + "Codes"); + + CString strTemp = ""; long strTempCount = 0; + STOCKDATA * pData = NULL; + long nIndex; + while(i + 5 < strCodes.GetLength()) + { + nIndex = atol( (LPSTR)(LPCTSTR)strCodes.Mid(i, 6) ); + pData = GetStockData( nIndex ); + if( pData != NULL ) + { + pData->bRejectedFromRegistery = true; + } + else + { + strTemp += strCodes.Mid(i, 6) + " "; + if( (++strTempCount % 4) == 0 ) strTemp += "\r\n"; + } + + i += 6; + } + + if( strTempCount ) + { + CString str; + str.Format("<°ÅºÎ¸®½ºÆ®1> Registery \r\n\r\n%s\r\nÀüü %d°³ 󸮺Ұ¡.", strTemp, strTempCount); + ::MessageBox(NULL, str, "Á¾¸ñÄÚµå ¿¹¿Üó¸®", MB_OK|MB_ICONSTOP|MB_TOPMOST); + } +} + +void CStockData::ListBoxLoad_RepeatedCode( CListBox *pListBox ) +{ + //////////////////////////////////////////////////////////////////////// + CString strAdd; + for( int i=0; iAddString(strAdd); + } + } +} + +void CStockData::ListBoxSave_RepeatedCode( CListBox *pListBox ) +{ + ////////////////////////////////////////////////////////////////// + int i; + for( i=0; iclose(); + SAFE_DELETE( m_pAddRepetitionCode ); + + TCHAR szFilePath[_MAX_PATH]={0,}; + ::GetModuleFileName(NULL, szFilePath, _MAX_PATH); + *(strrchr( szFilePath, '\\' ) + 1) = 0; + strcat( szFilePath, "Temp_RepetitionCode.tmp" ); + _unlink( szFilePath ); + + CString _strDate; + char szTmp[100]; + _strdate( szTmp ); + _strDate = szTmp; + + m_pAddRepetitionCode = new ofstream; + m_pAddRepetitionCode->open( szFilePath, ios::app ); + *m_pAddRepetitionCode << _strDate << endl; + + ////////////////////////////////////////////////////////////////// + long nIndex; + STOCKDATA * pData = NULL; + CString strCode; + for(i = 0; i < pListBox->GetCount(); i++) + { + pListBox->GetText(i, strCode); + + nIndex = atol( (LPSTR)(LPCTSTR)strCode.Left(6) ); + pData = GetStockData( nIndex ); + if( pData != NULL ) + { + pData->bRepeated = true; + *m_pAddRepetitionCode << strCode.Left(6) << endl; + } + } +} + +BOOL CStockData::Initialize_RepetitionCode( CString strFile ) +{ + if( m_pAddRepetitionCode != NULL ) + { + AfxMessageBox("Áߺ¹ÆÄÀÏ ÃʱâÈ­¸¦ÇÒ ¼ö ¾ø½À´Ï´Ù."); + return FALSE; + } + + ////////////////////////////////////////////////////////////////// + int i; + for( i=0; iopen( (LPSTR)(LPCSTR)strFile, ios::app ); + *m_pAddRepetitionCode << _strDate << endl; + return FALSE; + } + + long nCount=0; + + TRY + { + CString strTemp = ""; long strTempCount = 0; + long nIndex=0; + STOCKDATA * pData = NULL; + + CString _strFileDate; + if( file.ReadString(_strFileDate) ) + { + CString strSourceData; + while( file.ReadString(strSourceData) ) + { + if( "'" == strSourceData.Left(1) || strSourceData.GetLength() == 0 ) + continue; + + strSourceData.TrimLeft( " " ); + strSourceData.TrimRight( " " ); + + if( strSourceData.GetLength() >= 6 ) + { + nIndex = atol( (LPSTR)(LPCTSTR)strSourceData.Left(6) ); + pData = GetStockData( nIndex ); + if( pData != NULL ) + { + pData->bRepeated = true; + } + else + { + strTemp += strSourceData.Left(6) + " "; + if( (++strTempCount % 4) == 0 ) strTemp += "\r\n"; + } + } + } + + if( strTempCount ) + { + CString str; + str.Format("<Áߺ¹Á¾¸ñ(ÀÓ½ÃÀúÀå)> \r\n\r\n%s\r\nÀüü %d°³ 󸮺Ұ¡.", strTemp, strTempCount); + ::MessageBox(NULL, str, "Á¾¸ñÄÚµå ¿¹¿Üó¸®", MB_OK|MB_ICONSTOP|MB_TOPMOST); + } + + if( _strDate == _strFileDate && nIndex != 0 ) + { + bReturn = TRUE; + } + } + } + CATCH(CFileException, e) + { +#ifdef _DEBUG + afxDump << "Error during reading. " << e->m_cause << "\n"; +#endif + AfxMessageBox("Error during reading file."); + file.Close(); + return FALSE; + } + END_CATCH + + file.Close(); + + if( bReturn == FALSE ) + _unlink( strFile ); + + m_pAddRepetitionCode = new ::ofstream; + m_pAddRepetitionCode->open( (LPSTR)(LPCSTR)strFile, ios::app ); + + if( bReturn == FALSE ) + *m_pAddRepetitionCode << _strDate << endl; + + return TRUE; +} + +void CStockData::ListBoxLoad_ExclusionCode( CListBox *pListBox ) +{ + CString strAdd; + for( int i=0; iAddString(strAdd); + } + } +} + +void CStockData::ListBoxSave_ExclusionCode( CListBox *pListBox ) +{ + int i; + for( i=0; iGetCount(); i++) + { + pListBox->GetText(i, strCode); + + nIndex = atol( (LPSTR)(LPCTSTR)strCode.Left(6) ); + pData = GetStockData( nIndex ); + if( pData != NULL ) + { + pData->bRejectedFromFile = true; + } + } +} + +void CStockData::ListBoxLoad_SpecialCode( CListBox *pListBox ) +{ + CString strAdd; + for( int i=0; iAddString(strAdd); + } + } +} + +void CStockData::ListBoxSave_SpecialCode( CListBox *pListBox ) +{ + int i; + for( i=0; iGetCount(); i++) + { + pListBox->GetText(i, strCode); + + nIndex = atol( (LPSTR)(LPCTSTR)strCode.Left(6) ); + pData = GetStockData( nIndex ); + if( pData != NULL ) + { + pData->bSpecialCodeByPublish = true; + } + } +} + +void CStockData::ListBoxLoad_ManualInputCode( CListBox *pListBox ) +{ + CString strAdd; + for( int i=0; iAddString(strAdd); + } + } +} + +void CStockData::ListBoxSave_ManualInputCode( CListBox *pListBox ) +{ + int i; + for( i=0; iGetCount(); i++) + { + pListBox->GetText(i, strCode); + + nIndex = atol( (LPSTR)(LPCTSTR)strCode.Left(6) ); + pData = GetStockData( nIndex ); + if( pData != NULL ) + { + pData->bManualInputCode = true; + } + } +} + +void CStockData::AddRepeatedCode( CString strCode ) +{ + long nIndex = atol( (LPSTR)(LPCTSTR)strCode.Right(6) ); + STOCKDATA * pData = GetStockData( nIndex ); + if( pData != NULL ) + { + pData->bRepeated = true; + + if( m_pAddRepetitionCode != NULL ) + *m_pAddRepetitionCode << strCode.Right(6) << endl; + } +} + +BOOL CStockData::ReadFileSpecialCodeByPublish() +{ + int i; + for( i=0; i '9') + { + AfxMessageBox( "Á¾¸ñÄÚµå´Â ¼ýÀÚ¸¸ °¡´ÉÇÕ´Ï´Ù. (¼ýÀÚ 6ÀÚ¸®)" ); + return FALSE; + } + } + + nIndex = atol( (LPSTR)(LPCTSTR)strSourceData.Left(6) ); + pData = GetStockData( nIndex ); + if( pData != NULL ) + { + pData->bSpecialCodeByPublish = true; + } + else + { + strTemp += strSourceData.Left(6) + " "; + if( (++strTempCount % 4) == 0 ) strTemp += "\r\n"; + } + } + + if( strTempCount ) + { + CString str; + str.Format("<°ø½Ã_Ưº°Á¾¸ñÄÚµå.txt> \r\n\r\n%s\r\nÀüü %d°³ 󸮺Ұ¡.", strTemp, strTempCount); + ::MessageBox(NULL, str, "Á¾¸ñÄÚµå ¿¹¿Üó¸®", MB_OK|MB_ICONSTOP|MB_TOPMOST); + } + } + CATCH(CFileException, e) + { +#ifdef _DEBUG + afxDump << "Error during reading. " << e->m_cause << "\n"; +#endif + AfxMessageBox("Error during reading file."); + file.Close(); + return FALSE; + } + END_CATCH + + file.Close(); + return TRUE; +} + +BOOL CStockData::ReadFileExclusionCodeFromFile() +{ + int i; + for( i=0; ibRejectedFromFile = true; // °ÅºÎÁ¾¸ñ µî·Ï. + } + else + { + strTemp += token; strTemp += " "; + if( (++strTempCount % 4) == 0 ) strTemp += "\r\n"; + + break; + } + } else if( i==4 ) { + pData->lTradeCount = atol( token ); // °Å·¡·®. + *seps = 0x0D; // next read cr/lf. + } else if( i==5 ) { + pData->lTradeMoney = atol( token ); // °Å·¡±Ý¾×. + break; + } + + token = strtok( NULL, seps ); + } + } + + if( strTempCount ) + { + CString str; + str.Format("<°ÅºÎ_ÀüÀå°Å·¡ºÎÁøÁ¾¸ñÄÚµå.txt> \r\n\r\n%s\r\nÀüü %d°³ 󸮺Ұ¡.", strTemp, strTempCount); + ::MessageBox(NULL, str, "Á¾¸ñÄÚµå ¿¹¿Üó¸®", MB_OK|MB_ICONSTOP|MB_TOPMOST); + } + } + CATCH(CFileException, e) + { +#ifdef _DEBUG + afxDump << "Error during reading. " << e->m_cause << "\n"; +#endif + AfxMessageBox("Error during reading file."); + file.Close(); + return FALSE; + } + END_CATCH + + file.Close(); + return TRUE; +} + +BOOL CStockData::ReadFileManualInputCodeFromFile() +{ + int i; + for( i=0; i= 6 ) + { + long nIndex = atol( (LPSTR)(LPCTSTR)strSourceData.Left(6) ); + pData = GetStockData( nIndex ); + if( pData != NULL ) + { + pData->bManualInputCode = true; + } + else + { + strTemp += strSourceData.Left(6) + " "; + if( (++strTempCount % 4) == 0 ) strTemp += "\r\n"; + } + } + } + + if( strTempCount ) + { + CString str; + str.Format("<¼öµ¿_Á¾¸ñÄÚµå.txt> \r\n\r\n%s\r\nÀüü %d°³ 󸮺Ұ¡.", strTemp, strTempCount); + ::MessageBox(NULL, str, "Á¾¸ñÄÚµå ¿¹¿Üó¸®", MB_OK|MB_ICONSTOP|MB_TOPMOST); + } + } + CATCH(CFileException, e) + { +#ifdef _DEBUG + afxDump << "Error during reading. " << e->m_cause << "\n"; +#endif + AfxMessageBox("Error during reading file."); + file.Close(); + return FALSE; + } + END_CATCH + + file.Close(); + return TRUE; +}