Listview and Toolbar--Resizing Help Please!

This is a discussion on Listview and Toolbar--Resizing Help Please! within the Windows Programming forums, part of the Platform Specific Boards category; Alright, I know for toolbar, in WM_SIZE I can do... Code: HWND hTool; hTool = GetDlgItem(hwnd, IDC_MAIN_TOOL); SendMessage(hTool, TB_AUTOSIZE, 0, ...

  1. #1
    I am he who is the man! Stan100's Avatar
    Join Date
    Sep 2002
    Posts
    361

    Listview and Toolbar--Resizing Help Please!

    Alright, I know for toolbar, in WM_SIZE I can do...
    Code:
    HWND hTool;
    
    			hTool = GetDlgItem(hwnd, IDC_MAIN_TOOL);
    			SendMessage(hTool, TB_AUTOSIZE, 0, 0);
    Is there a quick way like that for my Listview too? Or do I need to find how much the toolbar takes up? My other question is if I do need to do this the second way (calculate the toolbar height and move the ListView accordingly), how do I go about moving the ListView's original staring X & Y coordinates?

    Thanks!
    Stan The Man. Beatles fan

    When I was a child,
    I spoke as a child,
    I thought as a child,
    I reasoned as a child.
    When I became a man,
    I put childish ways behind me"
    (the holy bible, Paul, in his first letter to the Cor. 13:11)

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,859
    >>Is there a quick way like that for my Listview too?

    AFAIK No. You have to resize manually.

    >>Or do I need to find how much the toolbar takes up?

    Yes GetClientRect() or GetWindowRect()

    >>how do I go about moving the ListView's original staring X & Y coordinates?

    I use SetWindowPos() or MoveWindow()
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  3. #3
    I am he who is the man! Stan100's Avatar
    Join Date
    Sep 2002
    Posts
    361
    Ok, here's the new question. Resiziing so that the listview's size is the width of the window when maximized:

    Is that just GetSystemMetrics or do I need to know something else?
    Stan The Man. Beatles fan

    When I was a child,
    I spoke as a child,
    I thought as a child,
    I reasoned as a child.
    When I became a man,
    I put childish ways behind me"
    (the holy bible, Paul, in his first letter to the Cor. 13:11)

  4. #4
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    You could handle the WM_SIZE message for the listview parent - the message LPARAM packs the client width and height of the parent as LOWORD/HIWORD which can be used to size/position any child controls as the parent's size is changed using the functions Novacain has already mentioned (MoveWindow, SetWindowPos). If you prefer, you can ignore the WM_SIZE message LPARAM and use GetClientRect as described previously by Novacain to get the parent's client dimensions.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Troubles with ListView and Toolbar
    By cornholio in forum Windows Programming
    Replies: 8
    Last Post: 11-14-2005, 01:26 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21