CImageList imagelist
#define IDI_ICON1 105
void CMainWindow::OnAddItem()
{
imagelist.Create(32, 32, ILC_COLOR32 | ILC_MASK, 2, 1);
imagelist.Add(AfxGetApp()->LoadIcon(IDI_ICON1)); //IDI_ICON1是图标ID
imagelist.Add(AfxGetApp()->LoadIcon(IDI_ICON1));
combobox.SetImageList(&imagelist);
combobox.AddString(L"123", 0);
combobox.AddString(L"456", 1);
combobox.SetCurSel(1);
m_listBox.AddString(_T("one"));
CString str1, str2;
int n;
for (int i = 0; i < combobox.GetCount(); i++)
{
n = combobox.GetLBTextLen(i);
combobox.GetLBText(i, str1.GetBuffer(n));
str1.ReleaseBuffer();
str2.Format(_T("item %d: %s\r\n"), i, str1.GetBuffer(0));
AFXDUMP(str2);
}
}