OwnCombo: Owner Draw and Combo Box Sample

Click to open or copy the files for the OwnCombo sample.

The Owncombo.exe example application illustrates the use of functions and messages for combo boxes and owner draw. The user interface of this example application is fairly self-explanatory except, perhaps, for the text combo box dialog. The Readme file provides an explanation of this portion of the application's user interface to help you interpret the source code.

The text combo box dialog buttons send various messages to the combo box and the edit control. These buttons allow the user to vary the data sent with each message.

The following actions are performed by the buttons:

Button Result
Unsl All Unselects any selection in the combo box.
Sel No Takes an integer value from the edit control and attempts to select an entry in the combo box given this index value.
Sel Txt Takes a text string from the edit control and attempts to select the item with the given text prefix.
Find Txt Searches for the text given in the edit control and returns the item number where it was found in the combo box.
Cb Dir Appends a directory listing of the current directory into the combo box.
Clr It Clears all the items in the combo box.
Add It Takes the string given in the edit control and adds it to the combo box.
Del It Deletes the currently selected item from the combo box.
Cpy It Copies the currently selected item in the combo box to the edit control.
Combo Notifications check box When this box is checked, a message box will appear showing what notification codes the combo box is returning to the application in response to the messages sent by the buttons.

Building SDK Samples

This sample uses the following keywords:

comboboxexample; createsolidbrush; defwindowproc; drawentireitem; enddialog; framerect; getdlgitem; getstockobject; getsyscolor; handlefocusstate; handleselectionstate; listboxexample; messagebox; owncomboinit; owncombowndproc; ownercomboboxexample; sendmessage; setdlgitemint; setdlgitemtext; unreferenced_parameter; winmain