Select item programmatically

Unlike a listbox control, the list view control does not has a SetCurSel() or the SetSel() function. To achieve that, we can use the following statement.
If you dont use the LVIS_FOCUSED flag and the control allows muliple selection, then you will likely end up with two items highlighted - one that has the focus and one that you just selected.

Another gotcha is that if you do not set the LVS_SHOWSELALWAYS style for the ListView control, you dont see the highlighting till the control gets focus.



  • how about SetSelectionMark

    Posted by leolyy on 01/10/2006 09:25pm

    how about SetSelectionMark 3x

  • can not see old comments

    Posted by cxq2003 on 12/03/2005 08:24pm

    can not see old comments

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Today's enterprise datacenter can be one of the most complex business environments with dozens (for smaller business), hundreds (for larger and midsize business), even thousands (for hyperscale businesses) of servers that must be managed and monitored. At this level, just managing the cords can be challenging — let alone keeping up with the growing need for more agility and scalability within the datacenter. Simply put, companies are aggressively looking for less complexity and more agility from their …

  • Today there's no such thing as "one size fits all" when it comes to enterprise mobile computing for field services workers. While the business benefits of automation are clear (e.g. decreased downtime, increased customer satisfaction), selecting the right mobile device mix for the job is becoming more complex. This whitepaper examines 3 challenges organizations face when considering a mobile device deployment for field teams: Integrating new mobile devices with legacy technology Adapting to multi-generational …

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date