Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Listview control--searching subitems

Posted on 1998-11-11
5
Medium Priority
?
473 Views
Last Modified: 2013-11-20
I've got a listview control with several columns. I am using CListCtrl::FindItem to search.  It finds matches when i'm searching for data in the first column of the listcontrol, but not when i'm searching for data that exists in any other column.  How do I search other columns?
0
Comment
Question by:jerryross
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 

Author Comment

by:jerryross
ID: 1324529
I figured it out...here is the code if you're curious:
 
  // declare variables
  int nIndexStart;
  LV_FINDINFO lvfi={0};
  ::ZeroMemory (&lvfi, sizeof (LV_FINDINFO));

  LV_ITEM dwItemData;  //stucture to hold item search data
  LV_ITEM *pdwItemData; // point to item search data
  dwItemData.mask = LVIF_TEXT; // to search for text
  dwItemData.iSubItem = 2;  // to search subitem column 2
  dwItemData.pszText = "Looking for this text"
             
  lvfi.flags = LVFI_PARAM; // to tell it to look at the item structure
  lvfi.lParam = (LPARAM) pdwItemData; // point at item structure

  nIndexStart = DefWindowProc(LVM_FINDITEM, (WPARAM)-1, (LPARAM)&lvfi);  //do search and return the index of the match

My question now is this:  How does it know which listview control i'm asking it to search?  The code works though so i'm happy :)

0
 
LVL 8

Accepted Solution

by:
Answers2000 earned 200 total points
ID: 1324530
LVM_FINDITEM is a message, use SendMessage to send it to a particular window

It knows with your code because it's DefWindowProc is a member of CWnd (base class of CListCtrl) and what you are really doing is :-

this->DefWindowProc(LVM_FINDITEM, (WPARAM)-1, (LPARAM)&lvfi);

0
 
LVL 8

Expert Comment

by:Answers2000
ID: 1324531
The this-> is implicit

If you want to specify a particular window to call a member function for use

pWnd->_whatever__
( for CWnd * and pointers to derived classes of CWnd)
or

wnd.__whatever__
( for actual CWnd objects, and derived classes of CWnd)
0
 

Author Comment

by:jerryross
ID: 1324532
Thank you ~!~
0
 

Expert Comment

by:geo_134
ID: 3930980
i need to find a item in particuar row
and highlight that particular row.i am have 1000 rows and 10 columns.i have used rowlist sample from msdn help.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question