How to hide a column of text in a CListCtrl?

I have a CListCtrl in my dialog that displays user information. One of the columns displays the user password. Is there a way to either a) hide a column so someone cannot resize it and view it, or b) show this column's text as asterisks (password text).
Who is Participating?
naveenkohliConnect With a Mentor Commented:
Since you don't want anybody to see that column, then don't add this column to list control. You can save the password information separately.
The place to store your passowrd information would be lParam member of LVITEM structure of your item.
Vinayak KumbarSr Program ManagerCommented:

If U want that information in ListCtrl only,  then subclass that control to ur class derived from CListCtrl and map the OnNotify() function and wrtie the following code

BOOL CDontResize::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)

      HD_NOTIFY *pHDN = (HD_NOTIFY*)lParam;
            if((pHDN->hdr.code == HDN_BEGINTRACKW || pHDN->hdr.code == HDN_BEGINTRACKA)
                        && (pHDN->iItem == 2) || (pHDN->iItem == 3) || (pHDN->iItem == 4) ||
                        (pHDN->iItem == 5) || (pHDN->iItem == 6) || (pHDN->iItem == 7) || (pHDN->iItem == 8))
                  *pResult = TRUE;
                  return TRUE;
      return CListCtrl::OnNotify(wParam, lParam, pResult);

Note that I have done it foe col 2 to 8(no resizing)

Try it out.
All Courses

From novice to tech pro — start learning today.