Thread: Prevent listview column resize

  1. #1
    Registered User
    Join Date
    Nov 2006
    Location
    under your bed....
    Posts
    24

    Prevent listview column resize

    Hey all win32 programmers

    Ive recently been coding a program using the listview control and cannot get the columns to stay a fixed size.

    Here is my code so far:
    Code:
    case WM_NOTIFY:
    {
    	LPNMLISTVIEW pNotify = (LPNMLISTVIEW)lParam;
    	if (wParam == IDC_LISTVIEW)
    	{
    		if(pNotify->hdr.code==HDN_BEGINTRACKW || pNotify->hdr.code==HDN_BEGINTRACKA)
    		{
    			return TRUE;
    		}
    	}
    }
    Does anyone know how to fix this?

    Thx in advance.

  2. #2
    Registered Abuser
    Join Date
    Jun 2006
    Location
    Toronto
    Posts
    591
    HDN_BEGINTRACK
    lParam is an LPNMHEADER, so try:
    Code:
    if(((LPNMHEADER)lParam)->hdr.code == HDN_BEGINTRACK)

  3. #3
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    I suspect that the header control notifications are sent to the list-view rather than the list-view parent.

    You could get the header control using ListView_GetHeader and then remove the HDS_DRAGDROP style using SetWindowLong.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Vertical column in ListView
    By underline_bruce in forum Windows Programming
    Replies: 6
    Last Post: 11-15-2008, 09:35 AM
  2. Resize Listview
    By mikeman118 in forum Windows Programming
    Replies: 4
    Last Post: 06-12-2008, 07:23 PM
  3. Retrieving Multiple inputs with fgets?
    By Axel in forum C Programming
    Replies: 25
    Last Post: 09-13-2005, 04:04 PM
  4. Listview arrow in column head
    By toso in forum Windows Programming
    Replies: 3
    Last Post: 08-30-2005, 12:05 PM
  5. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 09:32 AM