| 1 |
#include "stdafx.h" |
| 2 |
#include "WinCS.h" |
| 3 |
#include "APIReportDlg.h" |
| 4 |
|
| 5 |
IMPLEMENT_DYNAMIC(CAPIReportDlg, CDialog) |
| 6 |
|
| 7 |
BEGIN_MESSAGE_MAP(CAPIReportDlg, CDialog) |
| 8 |
ON_BN_CLICKED(IDC_BTN_PLUGIN_REPORT_LOG, &CAPIReportDlg::OnBnClickedListPluginReportLog) |
| 9 |
ON_BN_CLICKED(IDC_BTN_PLUGIN_REPORT_CLOSE, &CAPIReportDlg::OnBnClickedBtnPluginReportClose) |
| 10 |
END_MESSAGE_MAP() |
| 11 |
|
| 12 |
////////////////////////////////////////////////////////////////////////// |
| 13 |
|
| 14 |
CAPIReportDlg::CAPIReportDlg(CWnd* pParent /*=NULL*/) |
| 15 |
: CDialog(CAPIReportDlg::IDD, pParent) |
| 16 |
{ |
| 17 |
m_hIcon = AfxGetApp()->LoadIcon(IDI_INFO); |
| 18 |
} |
| 19 |
|
| 20 |
CAPIReportDlg::~CAPIReportDlg() |
| 21 |
{ |
| 22 |
} |
| 23 |
|
| 24 |
void CAPIReportDlg::DoDataExchange(CDataExchange* pDX) |
| 25 |
{ |
| 26 |
CDialog::DoDataExchange(pDX); |
| 27 |
DDX_Control(pDX, IDC_LIST_PLUGIN_REPORT_LOG, m_xReportList); |
| 28 |
DDX_Control(pDX, IDC_BTN_PLUGIN_REPORT_LOG, m_xBtnLog); |
| 29 |
} |
| 30 |
|
| 31 |
BOOL CAPIReportDlg::OnInitDialog() |
| 32 |
{ |
| 33 |
CDialog::OnInitDialog(); |
| 34 |
|
| 35 |
SetIcon(m_hIcon, TRUE); |
| 36 |
SetIcon(m_hIcon, FALSE); |
| 37 |
|
| 38 |
LVCOLUMN lvc; |
| 39 |
CString cs; |
| 40 |
LVITEM lvi; |
| 41 |
CRect cr; |
| 42 |
UINT nSize; |
| 43 |
|
| 44 |
lvc.mask = (LVCF_FMT | LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM); |
| 45 |
m_xReportList.GetClientRect(&cr); |
| 46 |
|
| 47 |
lvc.fmt = LVCFMT_RIGHT; |
| 48 |
lvc.cx = (cr.right - cr.left) * 4 / 30; |
| 49 |
lvc.pszText = _T("ID"); |
| 50 |
m_xReportList.InsertColumn(0, &lvc); |
| 51 |
|
| 52 |
lvc.fmt = LVCFMT_RIGHT; |
| 53 |
lvc.cx = (cr.right - cr.left) * 4 / 30; |
| 54 |
lvc.pszText = _T("Sub"); |
| 55 |
m_xReportList.InsertColumn(1, &lvc); |
| 56 |
|
| 57 |
lvc.fmt = LVCFMT_RIGHT; |
| 58 |
lvc.cx = (cr.right - cr.left) * 10 / 30; |
| 59 |
lvc.pszText = _T("IP Address"); |
| 60 |
m_xReportList.InsertColumn(2, &lvc); |
| 61 |
|
| 62 |
lvc.fmt = LVCFMT_RIGHT; |
| 63 |
lvc.cx = (cr.right - cr.left) * 10 / 30; |
| 64 |
lvc.pszText = _T("Runtime"); |
| 65 |
m_xReportList.InsertColumn(3, &lvc); |
| 66 |
|
| 67 |
m_xReportList.SetExtendedStyle(LVS_EX_FULLROWSELECT); |
| 68 |
m_xBtnLog.EnableWindow(m_fSaveLog); |
| 69 |
|
| 70 |
nSize = m_list.GetSize(); |
| 71 |
|
| 72 |
for (UINT i = 0; i < nSize; i++) |
| 73 |
{ |
| 74 |
lvi.mask = (LVIF_TEXT | LVIF_IMAGE); |
| 75 |
|
| 76 |
cs = DwToString(m_list[i].wNodeID); |
| 77 |
lvi.iItem = i; |
| 78 |
lvi.iSubItem = 0; |
| 79 |
lvi.pszText = MC_CStoSTR(cs); |
| 80 |
m_xReportList.InsertItem(&lvi); |
| 81 |
|
| 82 |
cs = DwToString(m_list[i].wSubID); |
| 83 |
lvi.iItem = i; |
| 84 |
lvi.iSubItem = 1; |
| 85 |
lvi.pszText = MC_CStoSTR(cs); |
| 86 |
m_xReportList.SetItem(&lvi); |
| 87 |
|
| 88 |
cs = DwToIPAddress(m_list[i].dwAddress); |
| 89 |
lvi.iItem = i; |
| 90 |
lvi.iSubItem = 2; |
| 91 |
lvi.pszText = MC_CStoSTR(cs); |
| 92 |
m_xReportList.SetItem(&lvi); |
| 93 |
|
| 94 |
cs.Format(_T("%.4lf sec"), m_list[i].dbRuntime); |
| 95 |
lvi.iItem = i; |
| 96 |
lvi.iSubItem = 3; |
| 97 |
lvi.pszText = MC_CStoSTR(cs); |
| 98 |
m_xReportList.SetItem(&lvi); |
| 99 |
} |
| 100 |
|
| 101 |
CenterWindow(GetDesktopWindow()); |
| 102 |
MessageBeep(MB_ICONASTERISK); |
| 103 |
|
| 104 |
return FALSE; |
| 105 |
} |
| 106 |
|
| 107 |
void CAPIReportDlg::OnBnClickedListPluginReportLog() |
| 108 |
{ |
| 109 |
GetParent()->PostMessage(WM_SHOW_LOG); |
| 110 |
} |
| 111 |
|
| 112 |
////////////////////////////////////////////////////////////////////////// |