The normal way of doing this is:
0) Create a bit map with 2 bitmap images per each tree item (one for selected state, one for non selected)
Define an enum that matches the order of images, for example:
enum
{
TREE_IMAGE_SERVER,
TREE_IMAGE_CLIENT,
};
1) In OnInitialUpdate do this:
if (!m_imageList.Create(IDB_IMAGELIST_TREE_SML,16,1,RGB(255,255,255)))
{
}
(void)tree.SetImageList(&m_imageList,TVSIL_NORMAL);
2) When you insert a tree item, do this:
tree.InsertItem(ti.m_Name, 2*TREE_IMAGE_SERVER, 2*TREE_IMAGE_SERVER+1);
It works.