Results 1 to 5 of 5

Thread: Getting a handle to the listbox portion of a ComboBox

  1. #1
    amac
    Guest

    Exclamation Getting a handle to the listbox portion of a ComboBox

    How do I get a handle to the listbox portion of a ComboBox?

  2. #2
    Megatron
    Guest
    The ComboBox is only shown when the ComboBox is clicked. Therefor, you need to catch the CBN_DROPDOWN notification message. Then use FindWindowEx() to get the handle of the control. I believe the class of the control is ComboListBox.

  3. #3
    amac
    Guest
    I tried to do that but FindWindowEx() returns NULL..

    I remember seeing in MSDN the class was ComboLBox.

    I tried ComboListBox too, but that didnt seem to work either...

    here is my FindWindowEx() call in the handler for the CBN_DROPDOWN notification message.

    HWND test = FindWindowEx ( hWnd, NULL, "ComboLBox", NULL );

    Where hWnd is the HWND of the combobox itself.

  4. #4
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827
    What is the listbox in a combobox actually? If that is the box in the combobox then you can use "ChildWindowFromPoint" with the x,y as 2,2 or a little more.
    Baaaaaaaaah

  5. #5
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    GetComboBoxInfo
    The GetComboBoxInfo function retrieves information about the specified combo box.

    BOOL GetComboBoxInfo(
    HWND hwndCombo, // handle to combo box
    PCOMBOBOXINFO pcbi // combo box information
    );
    Parameters
    hwndCombo
    [in] Handle to the combo box.
    pcbi
    [out] Pointer to a COMBOBOXINFO structure that receives the information.
    COMBOBOXINFO
    The COMBOBOXINFO structure contains combo box status information.

    typedef struct tagCOMBOBOXINFO {
    DWORD cbSize;
    RECT rcItem;
    RECT rcButton;
    DWORD stateButton;
    HWND hwndCombo;
    HWND hwndItem;
    HWND hwndList;
    } COMBOBOXINFO, *PCOMBOBOXINFO, *LPCOMBOBOXINFO;
    Members
    cbSize
    Specifies the size, in bytes, of the structure.
    rcItem
    A RECT structure that specifies the coordinates of the edit box.
    rcButton
    A RECT structure that specifies the coordinates of the button that contains the drop-down arrow.
    stateButton
    Specifies the combo box button state. This parameter can be one of the following values. Value Meaning
    0 The button exists and is not pressed.
    STATE_SYSTEM_INVISIBLE There is no button.
    STATE_SYSTEM_PRESSED The button is pressed.


    hwndCombo
    Handle to the combo box.
    hwndItem
    Handle to the edit box.
    hwndList
    Handle to the drop-down list.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width