// ScanRes.cpp : implementation file // #include "stdafx.h" #include "twnconfig.h" #include "ScanRes.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CScanRes dialog CScanRes::CScanRes(CWnd* pParent /*=NULL*/) : CDialog(CScanRes::IDD, pParent) { //{{AFX_DATA_INIT(CScanRes) //}}AFX_DATA_INIT } void CScanRes::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CScanRes) DDX_Control(pDX, IDC_EDIT_AVG_SCAN_TIME, m_EdtAvgScan); DDX_Control(pDX, IDC_EDIT_TOTAL_SCAN_TIME, m_EdtTotScan); DDX_Control(pDX, IDC_LIST_SCAN, m_LstTimeScan); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CScanRes, CDialog) //{{AFX_MSG_MAP(CScanRes) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CScanRes message handlers BOOL CScanRes::OnInitDialog() { CDialog::OnInitDialog(); CTwainConfigApp * pTheApp = (CTwainConfigApp *)AfxGetApp(); m_LstTimeScan.InsertColumn(0, _T("Scan #"), LVCFMT_LEFT, 90, -1); m_LstTimeScan.InsertColumn(1, _T("Time"), LVCFMT_LEFT, 90, -1); LV_ITEM lv; CString csText; L_UINT32 ulTotTime = 0; L_UINT uAvgTime = 0; memset(&lv, 0, sizeof(LV_ITEM)); for (int i=0; im_nScannedPageCount; i++) { csText.Format(_T("%d"), i+1); lv.mask = LVIF_TEXT | LVIF_PARAM; lv.iSubItem = 0; lv.iItem = i; lv.lParam = i; lv.pszText = (LPTSTR)(LPCTSTR)csText; lv.cchTextMax = csText.GetLength(); m_LstTimeScan.InsertItem(&lv); csText.Format(_T("%d ms"), pTheApp->m_pTime[i]); m_LstTimeScan.SetItemText(i, 1, csText); ulTotTime += pTheApp->m_pTime[i]; } uAvgTime = ulTotTime / pTheApp->m_nScannedPageCount; csText.Format(_T("%d ms"), ulTotTime); m_EdtTotScan.SetWindowText(csText); csText.Format(_T("%d ms"), uAvgTime); m_EdtAvgScan.SetWindowText(csText); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }