title: How do I find a item in ListView control?
body: <p>My list view contains 3 columns Name, address and phone number.</p>
  
  <p>I want to retrieve an index for a particular name.</p>
  
  <p>I'm using <code>ListView_FindItem</code> macro to find the index number but when my code comes to this line it crashes the program. </p>
  
  <p>It just says Payroll has stopped working. Windows can check online  for a solution to the problem.</p>
  
  <p>I'm sure I have passed right handle to the <code>ListView_FindItem</code> macro but I'm not sure about the <code>LVFINDINFO</code> structure.</p>
  
  <p>Here's my code</p>
  
  <pre><code>WCHAR szProcess[80] = {0};
  LVFINDINFO item = {LVFI_STRING, (LPCTSTR) szProcess};
  
  //code to find parent handles
  ...
  
  //code to find index
  index = ListView_FindItem(hwndListView, -1, &amp;item);
  </code></pre>
  
  <p>I'm not sure about the <code>LVFI_STRING</code> flag and I have even tried passing a constant <code>LVFINDINFO</code> structure to <code>ListView_FindItem</code> macro still my program crashes.</p>
  
  <blockquote>
    <p>Note : The above code is not part of
    the payroll application. I mean to say
    the payroll application has the
    listview and I'm trying to search the
    item from other application.</p>
  </blockquote>
  
  <p>Can some one point me in a right direction ?</p>
  
  <p>Thanks.</p>