| | |
| | | BEGIN_MESSAGE_MAP(CDialogEventLog, CDialogEx)
|
| | | ON_BN_CLICKED(IDC_BUTTON_CLEAR_EVENTLOG, &CDialogEventLog::OnBnClickedButtonClearEventlog)
|
| | | ON_BN_CLICKED(IDC_BUTTON_RELOAD, &CDialogEventLog::OnBnClickedButtonReload)
|
| | | ON_WM_TIMER()
|
| | | END_MESSAGE_MAP()
|
| | |
|
| | | KLink::stEventLog KEventLogs[20000];
|
| | |
| | |
|
| | | s1.Format(_T("Get EventLogCount Result r=%d N=%d "), res, nCount);
|
| | | SysLog(s1);
|
| | |
|
| | | if (res == pDoc->MyKLink1.KL_OK)
|
| | | {
|
| | | s1.Format(_T("%d"), nCount);
|
| | |
| | | int nStartIndex = 0;
|
| | | int nReadCount = 1;
|
| | | m_list_eventlog.DeleteAllItems();
|
| | | for (int i = 0; i < nCount; i++)
|
| | | {
|
| | | res = pDoc->MyKLink1.GetEventLog(1, i, nReadCount, &KEventLogs[i]);
|
| | | s1.Format(_T(" Get EventLog %d Result r=%d "),i, res);
|
| | | s1.AppendFormat(_T("%d %d %d %d %d %d"), KEventLogs[i].Sign1, KEventLogs[i].Seq1, KEventLogs[i].nTime, KEventLogs[i].nType, KEventLogs[i].nParam1, KEventLogs[i].nParam2);
|
| | | // SysLog(s1);
|
| | | s1.Format(_T("%d"), i);
|
| | | m_list_eventlog.InsertItem(i, s1);
|
| | | s1.Format(_T("%d"), KEventLogs[i].Seq1);
|
| | | m_list_eventlog.SetItemText(i, 1, s1);
|
| | |
|
| | | s1.Format(_T("%d"), KEventLogs[i].nTime);
|
| | | CTime ctime1 = KEventLogs[i].nTime;
|
| | | s1 = ctime1.Format(_T("%Y-%m-%d %H:%M:%S"));
|
| | |
|
| | | m_list_eventlog.SetItemText(i, 2, s1);
|
| | | s1.Format(_T("%d"), KEventLogs[i].nType);
|
| | | m_list_eventlog.SetItemText(i, 3, s1);
|
| | | s1.Format(_T("%d"), KEventLogs[i].nParam1);
|
| | | m_list_eventlog.SetItemText(i, 4, s1);
|
| | | s1.Format(_T("%d"), KEventLogs[i].nParam2);
|
| | | m_list_eventlog.SetItemText(i, 5, s1);
|
| | | }
|
| | | m_nEventCount = nCount;
|
| | | m_nCurEvent = 0;
|
| | | SetTimer(1, 100, NULL);
|
| | | // for (int i = 0; i < nCount; i++)
|
| | | // {
|
| | | // GetEventLogByIndex(i);
|
| | | // }
|
| | |
|
| | | return 0;
|
| | | }
|
| | |
| | | m_list_eventlog.InsertColumn(4, _T("数据1"), LVCFMT_LEFT, 128, -1);//LVCFMT_LEFT, LVCFMT_RIGHT, or LVCFMT_CENTER
|
| | | m_list_eventlog.InsertColumn(5, _T("数据2"), LVCFMT_LEFT, 128, -1);//LVCFMT_LEFT, LVCFMT_RIGHT, or LVCFMT_CENTER
|
| | |
|
| | | GetEventLogStatus();
|
| | | UpLoadEventLog();
|
| | | SetTimer(0, 10, NULL);
|
| | | return TRUE; // return TRUE unless you set the focus to a control
|
| | | // 异常: OCX 属性页应返回 FALSE
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | int CDialogEventLog::DelayInit()
|
| | | {
|
| | | // TODO: 在此处添加实现代码.
|
| | | GetEventLogStatus();
|
| | | UpLoadEventLog();
|
| | | return 0;
|
| | | }
|
| | |
|
| | |
|
| | | int CDialogEventLog::GetEventLogByIndex(int nIndex)
|
| | | {
|
| | | // TODO: 在此处添加实现代码.
|
| | | CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
|
| | | CMDIChildWnd *pChild = (CMDIChildWnd *)pFrame->GetActiveFrame();
|
| | | CView *pV = (CView*)pChild->GetActiveView();
|
| | | CMTerm2Doc* pDoc = (CMTerm2Doc *)(pV->GetDocument());
|
| | |
|
| | | int nReadCount = 1;
|
| | | int res;
|
| | | CString s1;
|
| | |
|
| | | res = pDoc->MyKLink1.GetEventLog(1, nIndex, nReadCount, &KEventLogs[nIndex]);
|
| | | s1.Format(_T(" Get EventLog %d Result r=%d "), nIndex, res);
|
| | | s1.AppendFormat(_T("%d %d %d %d %d %d"), KEventLogs[nIndex].Sign1, KEventLogs[nIndex].Seq1, KEventLogs[nIndex].nTime, KEventLogs[nIndex].nType, KEventLogs[nIndex].nParam1, KEventLogs[nIndex].nParam2);
|
| | | // SysLog(s1);
|
| | | s1.Format(_T("%d"), nIndex);
|
| | | m_list_eventlog.InsertItem(nIndex, s1);
|
| | | s1.Format(_T("%d"), KEventLogs[nIndex].Seq1);
|
| | | m_list_eventlog.SetItemText(nIndex, 1, s1);
|
| | |
|
| | | s1.Format(_T("%d"), KEventLogs[nIndex].nTime);
|
| | | CTime ctime1 = KEventLogs[nIndex].nTime;
|
| | | s1 = ctime1.Format(_T("%Y-%m-%d %H:%M:%S"));
|
| | |
|
| | | m_list_eventlog.SetItemText(nIndex, 2, s1);
|
| | | s1.Format(_T("%d"), KEventLogs[nIndex].nType);
|
| | | m_list_eventlog.SetItemText(nIndex, 3, s1);
|
| | | s1.Format(_T("%d"), KEventLogs[nIndex].nParam1);
|
| | | m_list_eventlog.SetItemText(nIndex, 4, s1);
|
| | | s1.Format(_T("%d"), KEventLogs[nIndex].nParam2);
|
| | | m_list_eventlog.SetItemText(nIndex, 5, s1);
|
| | | //m_list_eventlog.SetItemText(nIndex, 5, s1);
|
| | | return 0;
|
| | | }
|
| | |
|
| | |
|
| | | void CDialogEventLog::OnTimer(UINT_PTR nIDEvent)
|
| | | {
|
| | | // TODO: 在此添加消息处理程序代码和/或调用默认值
|
| | | if (nIDEvent == 0) {
|
| | | KillTimer(0);
|
| | | DelayInit();
|
| | | }
|
| | | else if (nIDEvent == 1) {
|
| | |
|
| | | GetEventProcess();
|
| | | }
|
| | | else
|
| | | {
|
| | |
|
| | | }
|
| | | CDialogEx::OnTimer(nIDEvent);
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | int CDialogEventLog::GetEventProcess()
|
| | | {
|
| | | // TODO: 在此处添加实现代码.
|
| | | if (m_nCurEvent < m_nEventCount)
|
| | | {
|
| | | GetEventLogByIndex(m_nCurEvent);
|
| | | m_nCurEvent++;
|
| | | if (m_nCurEvent >= m_nEventCount) { KillTimer(1); }
|
| | | }
|
| | | return 0;
|
| | | }
|