Michael Knight
asked on
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).
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The place to store your passowrd information would be lParam member of LVITEM structure of your item.
Hi,
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(WPAR AM 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.
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(WPAR
{
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
}
Note that I have done it foe col 2 to 8(no resizing)
Try it out.