| | |
| | | void CDlgLog::DoDataExchange(CDataExchange* pDX) |
| | | { |
| | | CDialog::DoDataExchange(pDX); |
| | | DDX_Control(pDX, IDC_LIST_LOG, m_ctrlLogListBox); |
| | | DDX_Control(pDX, IDC_LIST_LOG, m_ctrlLogList); |
| | | } |
| | | |
| | | BOOL CDlgLog::OnInitDialog() |
| | | { |
| | | CDialog::OnInitDialog(); |
| | | |
| | | // TODO: 여기에 추가 초기화 작업을 추가합니다. |
| | | m_ctrlLogList.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES); |
| | | m_ctrlLogList.InsertColumn(0, _T("시간"), LVCFMT_CENTER, 150); |
| | | m_ctrlLogList.InsertColumn(1, _T("내용"), LVCFMT_LEFT, 690); |
| | | |
| | | return TRUE; // return TRUE unless you set the focus to a control |
| | | // 예외: OCX 속성 페이지는 FALSE를 반환해야 합니다. |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | CDialog::OnSize(nType, cx, cy); |
| | | |
| | | if (m_ctrlLogListBox.GetSafeHwnd()) |
| | | if (m_ctrlLogList.GetSafeHwnd()) |
| | | { |
| | | m_ctrlLogListBox.SetWindowPos(NULL, 0, 0, cx, cy, SWP_NOZORDER); |
| | | m_ctrlLogList.SetWindowPos(NULL, 0, 0, cx, cy, SWP_NOZORDER); |
| | | } |
| | | |
| | | // TODO: 여기에 메시지 처리기 코드를 추가합니다. |
| | |
| | | |
| | | void CDlgLog::DisplayMessage(const CString& strMessage) |
| | | { |
| | | int nCount; |
| | | CTime time; |
| | | CString strStamp, strLog; |
| | | CString strStamp; |
| | | |
| | | nCount = m_ctrlLogListBox.GetCount(); |
| | | if (m_ctrlLogList.GetItemCount() > 100) |
| | | m_ctrlLogList.DeleteItem(0); |
| | | |
| | | if (nCount % MAX_PRINT_COUNT == 0) |
| | | { |
| | | m_ctrlLogListBox.ResetContent(); |
| | | } |
| | | //if (nCount % MAX_PRINT_COUNT == 0) |
| | | //{ |
| | | // m_ctrlLogList.ResetContent(); |
| | | //} |
| | | |
| | | SYSTEMTIME currentTime; |
| | | ::GetLocalTime(¤tTime); |
| | | time = CTime::GetCurrentTime(); |
| | | strStamp.Format(_T("[%02d:%02d:%02d]"), time.GetHour(), time.GetMinute(), time.GetSecond()); |
| | | strLog.Format(_T("%s %s"), strStamp, strMessage); |
| | | m_ctrlLogListBox.AddString(strLog); |
| | | m_ctrlLogListBox.SetCurSel(m_ctrlLogListBox.GetCount()-1); |
| | | } |
| | | strStamp.Format(_T("[%02d:%02d:%02d:%02d:%02d:%02d]"), time.GetYear(), time.GetMonth(), time.GetDay(), time.GetHour(), time.GetMinute(), time.GetSecond()); |
| | | |
| | | int nRow = m_ctrlLogList.InsertItem(m_ctrlLogList.GetItemCount(), strStamp); |
| | | m_ctrlLogList.SetItemText(nRow, 1, strMessage); |
| | | m_ctrlLogList.EnsureVisible(nRow, FALSE); |
| | | } |