576 lines
16 KiB
C++
576 lines
16 KiB
C++
// MakeRefusalListDlg.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "MakeRefusalList.h"
|
|
#include "MakeRefusalListDlg.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CAboutDlg dialog used for App About
|
|
|
|
class CAboutDlg : public CDialog
|
|
{
|
|
public:
|
|
CAboutDlg();
|
|
|
|
// Dialog Data
|
|
//{{AFX_DATA(CAboutDlg)
|
|
enum { IDD = IDD_ABOUTBOX };
|
|
//}}AFX_DATA
|
|
|
|
// ClassWizard generated virtual function overrides
|
|
//{{AFX_VIRTUAL(CAboutDlg)
|
|
protected:
|
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
|
//}}AFX_VIRTUAL
|
|
|
|
// Implementation
|
|
protected:
|
|
//{{AFX_MSG(CAboutDlg)
|
|
//}}AFX_MSG
|
|
DECLARE_MESSAGE_MAP()
|
|
};
|
|
|
|
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
|
|
{
|
|
//{{AFX_DATA_INIT(CAboutDlg)
|
|
//}}AFX_DATA_INIT
|
|
}
|
|
|
|
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CAboutDlg)
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
|
|
//{{AFX_MSG_MAP(CAboutDlg)
|
|
// No message handlers
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CMakeRefusalListDlg dialog
|
|
|
|
CMakeRefusalListDlg::CMakeRefusalListDlg(CWnd* pParent /*=NULL*/)
|
|
: CDialog(CMakeRefusalListDlg::IDD, pParent)
|
|
{
|
|
//{{AFX_DATA_INIT(CMakeRefusalListDlg)
|
|
m_nAmount = 1000;
|
|
m_nBM = 10000;
|
|
m_strOutputFileName = _T("거부_전장거래부진종목코드.txt");
|
|
//}}AFX_DATA_INIT
|
|
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
|
|
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
|
|
}
|
|
|
|
void CMakeRefusalListDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CMakeRefusalListDlg)
|
|
DDX_Control(pDX, IDC_RUN_PROGRESS, m_hRunProgress);
|
|
DDX_Text(pDX, IDC_AMOUNT_EDIT, m_nAmount);
|
|
DDX_Text(pDX, IDC_BM_EDIT, m_nBM);
|
|
DDX_Text(pDX, IDC_OUTPUTFILENAME_EDIT, m_strOutputFileName);
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
BEGIN_MESSAGE_MAP(CMakeRefusalListDlg, CDialog)
|
|
//{{AFX_MSG_MAP(CMakeRefusalListDlg)
|
|
ON_WM_SYSCOMMAND()
|
|
ON_WM_PAINT()
|
|
ON_WM_QUERYDRAGICON()
|
|
ON_BN_CLICKED(IDC_USING_AMOUNT_CHECK, OnUsingAmountCheck)
|
|
ON_BN_CLICKED(IDC_USING_BM_CHECK, OnUsingBmCheck)
|
|
ON_WM_CLOSE()
|
|
ON_BN_CLICKED(IDC_RUN_BTN, OnRunBtn)
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CMakeRefusalListDlg message handlers
|
|
|
|
BOOL CMakeRefusalListDlg::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
|
|
// Add "About..." menu item to system menu.
|
|
|
|
// IDM_ABOUTBOX must be in the system command range.
|
|
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
|
|
ASSERT(IDM_ABOUTBOX < 0xF000);
|
|
|
|
CMenu* pSysMenu = GetSystemMenu(FALSE);
|
|
if (pSysMenu != NULL)
|
|
{
|
|
CString strAboutMenu;
|
|
strAboutMenu.LoadString(IDS_ABOUTBOX);
|
|
if (!strAboutMenu.IsEmpty())
|
|
{
|
|
pSysMenu->AppendMenu(MF_SEPARATOR);
|
|
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
|
|
}
|
|
}
|
|
|
|
// Set the icon for this dialog. The framework does this automatically
|
|
// when the application's main window is not a dialog
|
|
SetIcon(m_hIcon, TRUE); // Set big icon
|
|
SetIcon(m_hIcon, FALSE); // Set small icon
|
|
|
|
// TODO: Add extra initialization here
|
|
((CButton*)GetDlgItem( IDC_USING_AMOUNT_CHECK ))->SetCheck(g_AppConfig.bUsingAmount);
|
|
((CButton*)GetDlgItem( IDC_USING_BM_CHECK ))->SetCheck(g_AppConfig.bUsingBM);
|
|
((CButton*)GetDlgItem( IDC_USING_KOSDAQ_CHECK ))->SetCheck(g_AppConfig.bUsingKosdaq);
|
|
((CButton*)GetDlgItem( IDC_USING_EXCHANGE_CHECK ))->SetCheck(g_AppConfig.bUsingExchange);
|
|
|
|
((CWnd*)GetDlgItem( IDC_AMOUNT_EDIT ))->EnableWindow( g_AppConfig.bUsingAmount );
|
|
((CWnd*)GetDlgItem( IDC_BM_EDIT ))->EnableWindow( g_AppConfig.bUsingBM );
|
|
|
|
m_nAmount = g_AppConfig.nAmount;
|
|
m_nBM = g_AppConfig.nBM;
|
|
|
|
UpdateData(FALSE);
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
|
}
|
|
|
|
void CMakeRefusalListDlg::OnSysCommand(UINT nID, LPARAM lParam)
|
|
{
|
|
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
|
|
{
|
|
CAboutDlg dlgAbout;
|
|
dlgAbout.DoModal();
|
|
}
|
|
else
|
|
{
|
|
CDialog::OnSysCommand(nID, lParam);
|
|
}
|
|
}
|
|
|
|
// If you add a minimize button to your dialog, you will need the code below
|
|
// to draw the icon. For MFC applications using the document/view model,
|
|
// this is automatically done for you by the framework.
|
|
|
|
void CMakeRefusalListDlg::OnPaint()
|
|
{
|
|
if (IsIconic())
|
|
{
|
|
CPaintDC dc(this); // device context for painting
|
|
|
|
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
|
|
|
|
// Center icon in client rectangle
|
|
int cxIcon = GetSystemMetrics(SM_CXICON);
|
|
int cyIcon = GetSystemMetrics(SM_CYICON);
|
|
CRect rect;
|
|
GetClientRect(&rect);
|
|
int x = (rect.Width() - cxIcon + 1) / 2;
|
|
int y = (rect.Height() - cyIcon + 1) / 2;
|
|
|
|
// Draw the icon
|
|
dc.DrawIcon(x, y, m_hIcon);
|
|
}
|
|
else
|
|
{
|
|
CDialog::OnPaint();
|
|
}
|
|
}
|
|
|
|
// The system calls this to obtain the cursor to display while the user drags
|
|
// the minimized window.
|
|
HCURSOR CMakeRefusalListDlg::OnQueryDragIcon()
|
|
{
|
|
return (HCURSOR) m_hIcon;
|
|
}
|
|
|
|
void CMakeRefusalListDlg::OnUsingAmountCheck()
|
|
{
|
|
BOOL bCheck = ((CButton*)GetDlgItem( IDC_USING_AMOUNT_CHECK ))->GetCheck();
|
|
((CWnd*)GetDlgItem( IDC_AMOUNT_EDIT ))->EnableWindow( bCheck );
|
|
}
|
|
|
|
void CMakeRefusalListDlg::OnUsingBmCheck()
|
|
{
|
|
BOOL bCheck = ((CButton*)GetDlgItem( IDC_USING_BM_CHECK ))->GetCheck();
|
|
((CWnd*)GetDlgItem( IDC_BM_EDIT ))->EnableWindow( bCheck );
|
|
}
|
|
|
|
void CMakeRefusalListDlg::OnClose()
|
|
{
|
|
CDialog::OnClose();
|
|
}
|
|
|
|
void CMakeRefusalListDlg::OnCancel()
|
|
{
|
|
CWnd* pWnd = (CWnd*)GetDlgItem( IDC_RUN_BTN );
|
|
DWORD dwStyle = pWnd->GetStyle();
|
|
if( dwStyle & WS_DISABLED )
|
|
{
|
|
CString str;
|
|
str.Format( "작업이 진행중입니다.\n프로그램을 종료하시겠습니까?" );
|
|
int nID = MessageBox( str, "프로그램 종료 질문", MB_ICONQUESTION|MB_YESNO );
|
|
if( nID == IDNO )
|
|
return;
|
|
}
|
|
|
|
UpdateData();
|
|
|
|
g_AppConfig.bUsingAmount = ((CButton*)GetDlgItem( IDC_USING_AMOUNT_CHECK ))->GetCheck();
|
|
g_AppConfig.bUsingBM = ((CButton*)GetDlgItem( IDC_USING_BM_CHECK ))->GetCheck();
|
|
g_AppConfig.bUsingKosdaq = ((CButton*)GetDlgItem( IDC_USING_KOSDAQ_CHECK ))->GetCheck();
|
|
g_AppConfig.bUsingExchange = ((CButton*)GetDlgItem( IDC_USING_EXCHANGE_CHECK ))->GetCheck();
|
|
|
|
g_AppConfig.nAmount = m_nAmount;
|
|
g_AppConfig.nBM = m_nBM;
|
|
|
|
CDialog::OnCancel();
|
|
}
|
|
|
|
void CMakeRefusalListDlg::OnRunBtn()
|
|
{
|
|
UpdateData();
|
|
|
|
CFile * pFile=NULL;
|
|
HANDLE hFile;
|
|
CString _strFileName;
|
|
TCHAR szFilePath[_MAX_PATH]={0,};
|
|
CStatic *pStatus = (CStatic*)GetDlgItem( IDC_PROGRESS_STATIC );
|
|
|
|
int nTotal=0;
|
|
long nAmount, nBM=0;
|
|
BOOL bCheck_AM;
|
|
BOOL bCheck_BM;
|
|
BOOL bCheck_KO;
|
|
BOOL bCheck_EX;
|
|
|
|
CString str;
|
|
str.Format( "거부리스트 검사는 몇분이 소요됩니다.\n"
|
|
"이 작업은 옵션적용이 되므로, 옵션설정이 맞는지 확인하세요.\n"
|
|
"작업을 계속 진행하시겠습니까?" );
|
|
int nID = MessageBox( str, "거부리스트 진행", MB_ICONQUESTION|MB_YESNO );
|
|
if( nID == IDNO )
|
|
goto _EXIT1_;
|
|
|
|
((CWnd*)GetDlgItem( IDC_RUN_BTN ))->EnableWindow(FALSE);
|
|
|
|
///////////////////////////////////////////////////////////////////
|
|
::GetModuleFileName(NULL, szFilePath, _MAX_PATH);
|
|
*(strrchr( szFilePath, '\\' ) + 1) = 0;
|
|
_strFileName.Format( "%s%s", szFilePath, m_strOutputFileName );
|
|
hFile = CreateFile(_strFileName,
|
|
GENERIC_WRITE, FILE_SHARE_READ,
|
|
NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
|
|
|
if (hFile == INVALID_HANDLE_VALUE)
|
|
{
|
|
AfxMessageBox( _strFileName + " 파일을 만들 수 없습니다." );
|
|
goto _EXIT1_;
|
|
}
|
|
else
|
|
{
|
|
pFile = new CFile(hFile);
|
|
pFile->SeekToEnd();
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////////////
|
|
bCheck_AM = ((CButton*)GetDlgItem( IDC_USING_AMOUNT_CHECK ))->GetCheck();
|
|
bCheck_BM = ((CButton*)GetDlgItem( IDC_USING_BM_CHECK ))->GetCheck();
|
|
bCheck_KO = ((CButton*)GetDlgItem( IDC_USING_KOSDAQ_CHECK ))->GetCheck();
|
|
bCheck_EX = ((CButton*)GetDlgItem( IDC_USING_EXCHANGE_CHECK ))->GetCheck();
|
|
|
|
if( bCheck_AM )
|
|
nAmount = m_nAmount;
|
|
if( bCheck_BM )
|
|
nBM = m_nBM;
|
|
|
|
if( (bCheck_AM == FALSE) && (bCheck_BM == FALSE) )
|
|
{
|
|
AfxMessageBox("거래량/거래금액 모두를 적용하지 않았습니다.\n\n적어도 하나는 지정하셔야 합니다.");
|
|
goto _EXIT1_;
|
|
}
|
|
if( (bCheck_KO == FALSE) && (bCheck_EX == FALSE) )
|
|
{
|
|
AfxMessageBox("코스닥/거래소 모두를 적용하지 않았습니다.\n\n적어도 하나는 지정하셔야 합니다.");
|
|
goto _EXIT1_;
|
|
}
|
|
|
|
try
|
|
{
|
|
long nCount;
|
|
HRESULT hr;
|
|
ICpStockCodePtr _objStockCode;
|
|
IDibPtr _objStockMst2;
|
|
CString strMsg;
|
|
|
|
pStatus->SetWindowText( "초기화 검사중..." );
|
|
|
|
hr = _objStockCode.CreateInstance( CLSID_CpStockCode ); // 종목코드변환.
|
|
if (SUCCEEDED(hr))
|
|
hr = _objStockMst2.CreateInstance( CLSID_StockMst2 ); // 주식 복수 종목에 대해 일괄 조회를 요청하고 수신한다
|
|
if (SUCCEEDED(hr))
|
|
{
|
|
char szFormat[256]={0,};
|
|
wsprintf( szFormat, "' -------------------------------------------------------------------------- \r\n" );
|
|
pFile->Write(szFormat, strlen(szFormat));
|
|
|
|
char szDate[100], szTime[100];
|
|
_strdate( szDate ); _strtime( szTime );
|
|
wsprintf( szFormat, "' 거부종목 검사일시 : %s : %s \r\n", szDate, szTime );
|
|
pFile->Write(szFormat, strlen(szFormat));
|
|
wsprintf( szFormat, "' 거부종목 검사설정 : 거래량(%s):%d주, 거래금액(%s):%d천원, 코스닥(%s), 거래소(%s) \r\n",
|
|
bCheck_AM?"O":"X", m_nAmount, bCheck_BM?"O":"X", m_nBM, bCheck_KO?"O":"X", bCheck_EX?"O":"X" );
|
|
pFile->Write(szFormat, strlen(szFormat));
|
|
wsprintf( szFormat, "' 종목코드, 종목명, 구분, 거래량, 거래금액(천원) \r\n");
|
|
pFile->Write(szFormat, strlen(szFormat));
|
|
|
|
wsprintf( szFormat, "' -------------------------------------------------------------------------- \r\n");
|
|
pFile->Write(szFormat, strlen(szFormat));
|
|
nCount = _objStockCode->GetCount();
|
|
|
|
CString _strJCode;
|
|
|
|
pStatus->SetWindowText( "전종목 코드 검사중..." );
|
|
//for(int _j=0; _j<nCount; _j++)
|
|
//{
|
|
// _strJCode = (LPCSTR)(_bstr_t)_objStockCode->GetData(0, _j);
|
|
// long nIndex = atol( (LPSTR)(LPCTSTR)_strJCode.Right(6) );
|
|
|
|
// // 1-장내, 5-코스닥, 6-제3시장
|
|
// TypeGuBun[ nIndex ] = (short)_objStockCode->GetData( 4, _j );
|
|
//}
|
|
|
|
m_hRunProgress.SetRange(0, (short)nCount);
|
|
m_hRunProgress.SetPos(0);
|
|
|
|
short j=0;
|
|
|
|
while( j<nCount )
|
|
{
|
|
long i=0;
|
|
char szCode[1024]={0,};
|
|
for(; (j<nCount)&&(i<100); j++, i++)
|
|
{
|
|
// 1-장내, 5-코스닥, 6-제3시장
|
|
short type = _objStockCode->GetData( 4, j );
|
|
CString strCode = (LPSTR)(_bstr_t)_objStockCode->GetData(0, j);
|
|
|
|
strcat( szCode, (LPSTR)(LPCTSTR)strCode );
|
|
strcat( szCode, "," );
|
|
}
|
|
|
|
if( strlen( szCode ) == 0 )
|
|
continue;
|
|
*(strrchr( szCode, ',' )) = NULL;
|
|
|
|
_objStockMst2->SetInputValue( 0, szCode );
|
|
_objStockMst2->BlockRequest();
|
|
|
|
strMsg.Format( "%d/%d 진행중", j, nCount );
|
|
pStatus->SetWindowText( strMsg );
|
|
|
|
short nRecv = (short)_objStockMst2->GetHeaderValue(0);
|
|
if( nRecv == 0 )
|
|
{
|
|
AfxMessageBox("수신된 데이터가 없습니다. Cybosplus 서비스 시간대를 확인해주세요.");
|
|
break;
|
|
}
|
|
|
|
for( long k=0; k<nRecv; k++ )
|
|
{
|
|
long nAmount_Current = (long)_objStockMst2->GetDataValue(11, k); // 11 : (unsigned long) 거래량
|
|
long nBM_Current = (long)_objStockMst2->GetDataValue(12, k); // 12 : (long) 거래대금(단위, 거래소:만원, 코스닥:천원)
|
|
|
|
CString strJCode = (LPSTR)(_bstr_t)_objStockMst2->GetDataValue(0, k); // 0 : (string) 종목 코드
|
|
long nIndex = atol( (LPSTR)(LPCTSTR)strJCode.Right(6) );
|
|
|
|
if(strJCode == "A000220")
|
|
{
|
|
TRACE("test");
|
|
}
|
|
|
|
//// 단위를 (천원)단위로 재계산.
|
|
// // 1-장내, 5-코스닥, 6-제3시장
|
|
//if( (TypeGuBun[nIndex]==1) && bCheck_EX)
|
|
// nBM_Current = nBM_Current * 10;
|
|
//else if( (TypeGuBun[ nIndex ]==5) && bCheck_KO)
|
|
// nBM_Current = nBM_Current * 1;
|
|
//else
|
|
// continue;
|
|
|
|
if( ((nAmount_Current <= nAmount) && bCheck_AM) ||
|
|
((nBM_Current <= nBM) && bCheck_BM) )
|
|
{
|
|
char szFormat[256]={0,};
|
|
wsprintf( szFormat, "%6s, %20s, [%d], %10d, %12d \r\n",
|
|
(LPSTR)(LPCTSTR)strJCode.Right(6),
|
|
(LPSTR)(LPCTSTR)(_bstr_t)_objStockMst2->GetDataValue(1, k),
|
|
0,
|
|
nAmount_Current, nBM_Current );
|
|
pFile->Write(szFormat, strlen(szFormat));
|
|
|
|
++nTotal;
|
|
}
|
|
else
|
|
{
|
|
TRACE("조건보다 큼");
|
|
}
|
|
}
|
|
|
|
m_hRunProgress.SetPos(j);
|
|
}
|
|
}
|
|
|
|
_objStockCode.Release();
|
|
_objStockMst2.Release();
|
|
|
|
strMsg.Format( "거부리스트 검사: %d종목.", nTotal );
|
|
pStatus->SetWindowText( strMsg );
|
|
AfxMessageBox( strMsg );
|
|
}
|
|
catch( _com_error e )
|
|
{
|
|
AfxMessageBox( "프로그램을 실행 할 수 없습니다!" );
|
|
}
|
|
catch(...)
|
|
{
|
|
AfxMessageBox( "프로그램실행중 문제가 발생하였습니다." );
|
|
}
|
|
|
|
_EXIT1_:
|
|
if( pFile )
|
|
{
|
|
pFile->Close();
|
|
SAFE_DELETE( pFile );
|
|
}
|
|
|
|
((CWnd*)GetDlgItem( IDC_RUN_BTN ))->EnableWindow(TRUE);
|
|
}
|
|
/*
|
|
void CMakeRefusalListDlg::OnManageCodeBtn()
|
|
{
|
|
UpdateData();
|
|
|
|
CFile * pFile=NULL;
|
|
HANDLE hFile;
|
|
CString _strFileName;
|
|
TCHAR szFilePath[_MAX_PATH]={0,};
|
|
CStatic *pStatus = (CStatic*)GetDlgItem( IDC_PROGRESS_STATIC );
|
|
|
|
CString str;
|
|
str.Format( "전종목 관리/감독 종목검사는 최소30분이 소요됩니다.\n"
|
|
"이 작업은 옵션적용이 없습니다.\n"
|
|
"'관리감독종목.txt'파일을 생성합니다.\n"
|
|
"작업을 계속 진행하시겠습니까?" );
|
|
int nID = MessageBox( str, "관리/감독 종목검사 진행", MB_ICONQUESTION|MB_YESNO );
|
|
if( nID == IDNO )
|
|
goto _EXIT2_;
|
|
|
|
((CWnd*)GetDlgItem( IDC_RUN_BTN ))->EnableWindow(FALSE);
|
|
((CWnd*)GetDlgItem( IDC_MANAGE_CODE_BTN ))->EnableWindow(FALSE);
|
|
|
|
///////////////////////////////////////////////////////////////////
|
|
::GetModuleFileName(NULL, szFilePath, _MAX_PATH);
|
|
*(strrchr( szFilePath, '\\' ) + 1) = 0;
|
|
_strFileName.Format( "%s관리감독종목.txt", szFilePath );
|
|
hFile = CreateFile(_strFileName,
|
|
GENERIC_WRITE, FILE_SHARE_READ,
|
|
NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
|
if (hFile == INVALID_HANDLE_VALUE)
|
|
{
|
|
AfxMessageBox(_T("'관리감독종목.txt' 파일을 만들 수 없습니다."));
|
|
goto _EXIT2_;
|
|
}
|
|
else
|
|
{
|
|
pFile = new CFile((int)hFile);
|
|
pFile->SeekToEnd();
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////////////
|
|
try
|
|
{
|
|
long nCount;
|
|
HRESULT hr;
|
|
ICpStockCodePtr _objStockCode;
|
|
IDibPtr _objStockMst;
|
|
|
|
CString strMsg;
|
|
pStatus->SetWindowText( "최기화 검사중..." );
|
|
|
|
long nTotal=0;
|
|
hr = _objStockCode.CreateInstance( CLSID_CpStockCode ); // 종목코드변환.
|
|
if (SUCCEEDED(hr))
|
|
hr = _objStockMst.CreateInstance( CLSID_StockMst ); // 주식 종목에 대해 현재가에 관련된 모든 정보를 한 눈에 볼 수 있게
|
|
if (SUCCEEDED(hr))
|
|
{
|
|
CString _strJCode;
|
|
nCount = _objStockCode->GetCount();
|
|
|
|
m_hRunProgress.SetRange(0, (short)nCount);
|
|
m_hRunProgress.SetPos(0);
|
|
|
|
for(int _j=0; _j<nCount; _j++)
|
|
{
|
|
_strJCode = (LPCSTR)(_bstr_t)_objStockCode->GetData(0, _j); // 종목코드.
|
|
|
|
// 1-장내, 5-코스닥, 6-제3시장
|
|
short sType = (short)_objStockCode->GetData( 4, _j );
|
|
if( sType == 1 || sType == 5 )
|
|
{
|
|
_objStockMst->SetInputValue(0,(LPSTR)(LPCTSTR)_strJCode);
|
|
_objStockMst->BlockRequest();
|
|
BYTE cbCodeGubun = _objStockMst->GetHeaderValue(44);
|
|
if( cbCodeGubun != '0' ) // 0: 정상, 1: 감리, 2: 관리, 3: 거래정지, ...
|
|
{
|
|
CString _strJName = (LPCSTR)(_bstr_t)_objStockCode->GetData(1, _j); // 종목명.
|
|
|
|
char szFormat[256]={0,};
|
|
wsprintf( szFormat, "%5s,%C, %20s \r\n",
|
|
(LPSTR)(LPCTSTR)_strJCode.Right(5), cbCodeGubun, (LPSTR)(LPCTSTR)_strJName );
|
|
pFile->Write(szFormat, strlen(szFormat));
|
|
|
|
++nTotal;
|
|
}
|
|
}
|
|
|
|
m_hRunProgress.SetPos(_j);
|
|
|
|
strMsg.Format( "%d/%d 진행중", _j, nCount );
|
|
pStatus->SetWindowText( strMsg );
|
|
}
|
|
}
|
|
|
|
_objStockCode.Release();
|
|
_objStockMst.Release();
|
|
|
|
strMsg.Format( "관리감독종목 검사: %d종목.", nTotal );
|
|
pStatus->SetWindowText( strMsg );
|
|
AfxMessageBox( strMsg );
|
|
}
|
|
catch( _com_error e )
|
|
{
|
|
AfxMessageBox( "프로그램을 실행 할 수 없습니다!" );
|
|
}
|
|
catch(...)
|
|
{
|
|
AfxMessageBox( "프로그램실행중 문제가 발생하였습니다." );
|
|
}
|
|
|
|
_EXIT2_:
|
|
if( pFile )
|
|
{
|
|
pFile->Close();
|
|
SAFE_DELETE( pFile );
|
|
}
|
|
|
|
((CWnd*)GetDlgItem( IDC_RUN_BTN ))->EnableWindow(TRUE);
|
|
((CWnd*)GetDlgItem( IDC_MANAGE_CODE_BTN ))->EnableWindow(TRUE);
|
|
}
|
|
*/
|