The ComboBox/ListBox Explorer
A question came up where, due to a fundamentally serious set of errors in both the documentation and implementation of the WM_DELETEITEM message, a great deal of confusion arose.
The confusion was justified. The poor quality of the documentation is not. The bugs in the implementation, even less so. They are unforgiveable.
Nonetheless, we are stuck with the poor implementation; key here is that the documentation should at least reflect the actual behavior. I describe the basic problem here.
The program I used is downloadable.
This is designed to test several specific features.
The style of control, ListBox or ComboBox can be chosen. In the case of a ComboBox, the forms Simple, Dropdown or DropList can be selected. The style of the control can be owner-drawn (there is a specific set of owner-draw routines in subclasses called COwnerCombo and COwnerList that can be used as prototypes, but details are specific to this implementation, such as the fact that the OnDeleteItem knows that the itemData is always a pointer to a constant string, and therefore must not actually be deleted. The type, CBS_OWNERDRAWFIXED/CBS_OWNERDRAWVARIABLE or LBS_OWNERDRAWFIXED/LBS_OWNERDRAWVARIABLE can be selected. The CBS_HASSTRINGS/LBS_HASSTRINGS option can be chosen.
The Delete button will delete an existing control, and Create will create a new control based on the selections shown. Note that selecting styles will not change the existing control.
The Trace options indicate which of the messages will be traced; originally, I set it up to only trace WM_DELETEITEM messages, but decided that showing all messages would be useful. The default upon startup is that WM_DELETEITEM is enabled and the others are disabled.
Clear Log will clear the log window. Print Log will bring up a standard print dialog and print the contents of the log, and Save Log will save the text in a file for later examination.
That's all there is to it.
Note that this is a quick-and-dirty hack; I did not fill in everything as extensively as I would in a product, such as putting all the strings in the STRINGTABLE. Perhaps if time allows in the future, I may fix this, but since this duplicates a number of features of my Control Explorer (to be released sometime in the future), I chose not to expend all the effort in this program. This represents about six hours of work, spread over about a day of real time, tucked in between various concerts, holiday parties, grocery shopping expeditions, and the like. A Very Merry Winter Solstice Holiday Of Your Choice.