I'm trying to get a header control to work with some listboxes so when the user drags a header, the listboxes (each listbox is supposed to be a column) are resized to match up with the header. So when I receive the HDN_TRACK message this is what I do:
Code:
case HDN_TRACK:
NMHEADER* nmh = (LPNMHEADER)lParam;
RECT rc;
GetWindowRect(GetDlgItem(hwnd,IDC_LIST1),&rc);
SendMessage(GetDlgItem(hwnd,IDC_LIST1),WM_SIZE,SIZE_RESTORED,MAKELPARAM(nmh->pitem->cxy,rc.bottom-rc.top));
break;
But for some reason, no matter what lparam is in the call to SendMessage, the listbox doesn't change size.
If it helps, here's the declaration of the listbox in the resource script (generated by VS):
Code:
LISTBOX IDC_LIST1,0,32,300,155,LBS_SORT | LBS_NOINTEGRALHEIGHT |
NOT WS_BORDER | WS_VSCROLL | WS_TABSTOP