I made some changes to the source code described in my October 2000 Dr. Dobb's Journal article in response to suggestions from a reader. Click for the revised source code. This source code and the samples below may be used in any program, including commercial ones. Please credit me in your program's help file or documentation.
In the following image, the list box shows the difference between alphabetic and alphanumeric ordering. Running SortTest will show this difference also in check list boxes, list controls, combo boxes, tree controls and owner-draw list boxes. SortText.exe is in the Release folder of SortTest.zip.

SortTest.zip (192 KB)
This archive contains the source code and the SortTest project
files. The necessary window styles are listed in the comments in
the Sort*.cpp files. In debug mode, the sort classes assert if
required styles are absent or prohibited styles are present.
To incorporate CSortListBox into a dialog box or a property page, put the following lines into the the dialog box's or property page's .H file:
#include "SortListBox.h" |
// near the top of the file |
CSortListBox m_listBox2; |
// among the attributes |
In the corresponding .CPP file, put the following line into OnInitDialog()
before this control is referenced. Be sure to remove the
corresponding variable from ClassWizard's list and to set the
styles as indicated in SortListBox.cpp.
m_listBox2.SubclassDlgItem (IDC_LIST2, this);
Here, the styles are:
Optional: sort, horizontal scroll, vertical scroll
Do not select: owner-draw (fixed or variable)
Note that sorting can be turned off by changing a style. This list-box class also handles adjusting the horizontal extent.
The instructions for incorporating the other controls into an application are similar.
See the changes page for a list of SortTest improvements.
ClipHint (Formatted
Text Clipboard Editor) 2.1
Allows you to modify formatted or unformatted text before you
paste it into an application. It displays a hint of the current
item in its Taskbar button label. It stores many Clipboard items
and restores them upon program start. These items are normally
stored in the main history list. However, ClipHint contains a
secondary list that can be used for storing frequently-used items.
It includes incremental searching, launching, merging and
splitting of items. These searches may be typo-insensitive. It
has one-step undo and a secondary window called a mini-window.
This window stays on top of regular windows and provides an easy
way to paste in a sequence of items. Requires Windows 95 or
Windows NT 3.51 or higher. (Released on 22-March-2009. Fee: $10)
AnnWebLinks (Annotated
Web Links) 2.0
Allows you to describe, search, sort, import and categorize web
links. It is intended to supplement browser favorites or
bookmarks. However, it can also store annotated filenames or
folder names. It is useful for job hunting. (Released on 11-Jan-2009.
Fee: $10)
david dot wincelberg at gmail dot com
(In the above line, change "at" and "dot" to
their symbols and remove the spaces to produce my e-mail address.)
Return to main page
Last updated: 18-June-2009
Page address: http://www.FileJockeySoftware.com/ANO/index.html