Highlight Row w/ CListCtrl

I'm using VC++ 5.0 and have a dialog based app/ with a List Control Box.  I want to be able to highlight an entire row when it's selected.  Right now only the first column is lit.  I've been out to codeguru and those samples all seem to deal with a CListView class written for a SDI app.  Plus it seems like an awful lot of code just to highlight a row.  Is it necessary to create a subclass using CListView, if so I'm not sure how to integrate it with my app.  Also, I'm not using any icons(images) in my report view CListCtrl if that will make coding any easier.  It seems like this should be an easy answer if anyone has some sample code they can post.  Hopefully, my objective can be met while staying in my Dialog class and not have to create a CListView class.
halenAsked:
Who is Participating?
 
naveenkohliConnect With a Mentor Commented:
Add this code in your OnInitdialogBox function.

CMyDialog::OnInitDialog ()
{

// Add LVS_EX_FULLROWSELECT to list control style so clicking
      // on any part of the list selects the whole row.
CWnd *pWnd = GetDlgItem (IDC_LIST1);
DWORD dwStyle = pWnd->SendMessage (LVM_GETEXTENDEDLISTVIEWSTYLE);
dwStyle |= LVS_EX_FULLROWSELECT;

pWnd->SendMessage (LVM_SETEXTENDEDLISTVIEWSTYLE, 0, (LPARAM)dwStyle);
0
 
halenAuthor Commented:
Excellent!  That appears to really hit the spot.  That looks to be an undocumented feature since I couldn't find any info on LVS_EX_FULLROWSELECT or LVM_GETEXTENDEDLISTVIEWSTYLE.
0
 
naveenkohliCommented:
Its true helen..
i also learnt it the hard way.... going down the bowls of MFC source code ..
0
All Courses

From novice to tech pro — start learning today.