views:

84

answers:

1

I'm iterating through the controls in a dialog and I'm trying to determine if a combobox was created with the WS_VSCROLL style.

The style, obtained from GetWindowLong(hwnd, GWL_STYLE), doesn't contain the WS_VSCROLL bit (0x200000), even when I know it was set on create.


Clarification: I am looking to see if the ComboBox was created with the WS_VSCROLL style. Calling GetWindowLong() (or using spy++) to get the style of the combo's listbox will include WS_VSCROLL if a scrollbar is needed to based on the current contents of the list.

I am trying to determine if the ComboBox was created with WS_VSCROLL, not if a scrollbar is currently visible.

+2  A: 

Then something removed the style. Styles don't just dissapear (AFAIK). What does Spy++ or WinCheat tell you?

Also keep in mind comboboxes consist of more than one HWND. There's the outer control, a text box (if applicable), and a list box. You're probably more interested in the list box's style.

EDIT: Use GetComboBoxInfo to programmatically get the HWND of the list box.

zildjohn01
They disappear if the implementation of the control removes it specifically. Could be that it does because the list is what requires that style rather than the parent window.
Jeff Yates
That makes a lot of sense, +1
zildjohn01
The combo (and list box) don't actually store WS_VSCROLL from create in the windows style. The winproc updates WS_VSCROLL when the list is manipulated (add/remove/etc) so that it indicates if a vertical scrollbar is currently displayed
Adam Tegen