void CADHistFrm::OnBUTTONPositionB() { CADHistDoc* pDoc = theApp.m_pADHistDoc; CADHistWaveView* pWaveView = (CADHistWaveView*)CWnd::FromHandle(pDoc->m_hWndWave); CADHistDigitView* pView = (CADHistDigitView*)CWnd::FromHandle(pDoc->m_hWndDigit); CString strPositionB;; CStatic* pStaticB = (CStatic*)m_wndSetupBar.GetDlgItem(IDC_STATIC_PositionB); pStaticB->GetWindowText(strPositionB); pView->SetListView(); CListCtrl& List = pView->GetListCtrl(); LPCTSTR lpszmyString = strPositionB; LVFINDINFO info; int nIndex; info.flags = LVFI_STRING ; info.psz = lpszmyString; while ((nIndex = List.FindItem(&info)) != -1) { if (nIndex >= 0) { List.EnsureVisible(nIndex, FALSE); //使listctrl中一项可见,即滚动滚动条 List.SetItemState(nIndex, 2 , LVIS_SELECTED|LVIS_FOCUSED); //选中选中一行(0,为取消) List.SetFocus(); break; } } Invalidate(); }
// return the text at the specified column CString CCustomListRowWnd::GetText(INT32 col) const { CStatic* pStat = (CStatic*)m_ColumnObjects[col]; CString ret ; pStat->GetWindowText(ret); return ret; }
LRESULT CAboutDialog::OnInitDialog(HWND hWnd, LPARAM lParam) { BOOL fSuccess = FALSE; CenterWindow(GetParent()); m_wndHyperLink.SubclassWindow(GetDlgItem(IDC_LINK)); CString strHyperLink; strHyperLink.LoadString(IDS_ABOUTDLG_HYPERLINK); m_wndHyperLink.SetHyperLink(strHyperLink); CString strAppVer, strProdVer; pGetVersionStrings(strAppVer, strProdVer); CString strProdVerText; TCHAR szProdVerFmt[256] = {0}; CStatic wndProdVer; wndProdVer.Attach(GetDlgItem(IDC_PRODVER)); wndProdVer.GetWindowText(szProdVerFmt, 256); strProdVerText.FormatMessage(szProdVerFmt, strProdVer); wndProdVer.SetWindowText(strProdVerText); CStatic wndProdName; wndProdName.Attach(GetDlgItem(IDC_PRODNAME)); wndProdName.SetFont(pGetTitleFont()); CListViewCtrl wndListView(GetDlgItem(IDC_COMPVER)); CString colName[2]; fSuccess = colName[0].LoadString(IDS_ABOUTDLG_COL_COMPONENT); ATLASSERT(fSuccess); fSuccess = colName[1].LoadString(IDS_ABOUTDLG_COL_VERSION); ATLASSERT(fSuccess); wndListView.AddColumn(colName[0], 0); wndListView.AddColumn(colName[1], 1); wndListView.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT); CString strAppTitle; strAppTitle.LoadString(IDS_MAIN_TITLE); wndListView.AddItem(0, 0, strAppTitle); wndListView.SetItemText(0, 1, strAppVer); CRect rcListView; wndListView.GetClientRect(rcListView); wndListView.SetColumnWidth(0, LVSCW_AUTOSIZE); wndListView.SetColumnWidth(1, rcListView.Width() - wndListView.GetColumnWidth(0)); // // Image Header // m_pix.LoadFromResource( _Module.GetResourceInstance(), IDB_ABOUT_HEADER, _T("IMAGE")); // // Enable/Disable Check for update button // m_wndUpdate.Attach(GetDlgItem(IDC_CHECK_UPDATE)); AutoHModule hUpdateDLL = ::LoadLibrary(_T("ndupdate.dll")); if (NULL != (HMODULE)hUpdateDLL) { } else { m_wndUpdate.ShowWindow(FALSE); } return TRUE; }