Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
How to prevent resizing of column in CListCtrl
I am working on a CDHTMLDialog based application where I ahve added a CListCtrl as shown below.
The list control has only one column.
IDD_TEST_DIALOG DIALOGEX 0, 0, 419, 286
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
FONT 8, "MS Shell Dlg", 0, 0, 0x1
CONTROL "",IDC_LIST_TEXT,"SysListView32",LVS_REPORT | LVS_OWNERDATA | LVS_NOSORTHEADER | NOT WS_VISIBLE | WS_BORDER | WS_TABSTOP,20,143,397,136
The problem is that I can drag the colum header to extreme left and the column goes hidden. To bring it back I will have to again drag the column header to the right.
I want to prevent resizing of this column so that the user cannot drag this completely to the left and make it hidden.
I did try the following code but it is not working.
void CMyTestDlg::OnHDNEndtrackListLog(NMHDR *pNMHDR, LRESULT *pResult)
LPNMHEADER phdr = reinterpret_cast(pNMHDR);
// TODO: Add your control notification handler code here
if(m_ListCtrl.GetColumnWidth(0) < 100)
*pResult = 0;
Since I have very less time to implement this, I request you kindly give me some examples from MFC Dialog based applications.