Search code examples
c++windowswinapimenubar

How can I include a DropDownList in a menu bar using the Windows API?


Assuming programming in C++ for the Win32 API, I would know if it is possible to include a DropDownList (COMBOBOX window with CBS_DROPDOWNLIST style) in a menu bar.

Any light in that matter or where start to learn on the topic would be appreciated.


Solution

  • Owner drawing is your only option for customizing the built-in API menus. Not only is that a giant pain in the rear, it still won't produce the effect that you want. You'd have to draw the combo box by hand and write code to respond to all the mouse events, instead of just dropping in a standard combo box control.

    My suggestion is to use either a toolbar or a rebar control that simulates a menu bar, rather than the standard menu bar. This is what Windows (and Internet) Explorer does to draw its menu bar, and it provides you with a lot more flexibility in what controls can be included.