stops (\t) in them, like this...
#include "windows.h"
#include "windowsx.h"
HWND hList = // get a ListBox handle somehow
int columns[] = { 100, 200 };
ListBox_SetTabStops(hList, 2, &columns);
ListBox_AddString(hList, "Col 1\tCol 2\tCol 3");
ListBox_AddString(hList, "Foo\tBar\tBaz");
ListBox_AddString(hList, "Red\tGreen\tBlue");
This inserts two tab stops into the ListBox at 100 and 200 pixels,
respectively. So, when the first string added is displayed, for example,
"Col 1" will appear (horizontally) at pixel 0, "Col 2" will appear at pixel
100 and "Col 3" will appear at pixel 200.
Note that, if your ListBox items become too wide in this kind of situation,
create your ListBox with the standard WS_HSCROLL style and then send it a
LB_SETHORIZONTALEXTENT message to allow the user to scroll the ListBox
horizontally. For example, if the ListBox manipulated by the sample code
above was actually only 200 pixels wide (and assuming each row needed 300),
you might also do this...
ListBox_SetHorizontalExtent(
...to allow the user to scroll the ListBox left and right.
You may be tempted to use the LBS_MULTICOLUMN ListBox style. However, this
is probably not appropriate for what you are doing. LBS_MULTICOLUMN makes
the ListBox automatically "snake" the items from one column to the next
(ordering your items like columns in a newspaper). This is a seldom-used
style of ListBox. Also, all columns must have the same width (as set by the
LB_SETCOLUMNWIDTH message).