programación, Windows, WTL, problemas20 September, 2006 7:54 am
Despues de media mañana intentando insertar imagenes en un CComboBoxEx, por el momento me doy por vencido. El código es el siguiente:
LRESULT CLog::OnInitDialog(UINT , WPARAM, LPARAM, BOOL&)
{
mComboEx.Attach(GetDlgItem(IDC_COMBO));
CBitmap bmp;
bmp.LoadBitmap(IDINSTALL);
mImg.Create(16, 16, ILC_COLOR8|ILC_MASK, 2, 1);
mImg.Add(bmp, RGB(0xFF,0x00,0xFF));
mComboEx.SetImageList(mImg);
for(int i =0; i<5; i++)
{
COMBOBOXEXITEM cb={0};
cb.mask=CBEIF_TEXT | CBEIF_IMAGE | CBEIF_SELECTEDIMAGE;
cb.pszText=L”ola”;
cb.cchTextMax=strlen(”ola”)*sizeof(TCHAR);
cb.iImage=0;
cb.iSelectedImage=1;
cb.iItem=mCombo.GetCount();
mComboEx.InsertItem(&cb);
}
}
Sobra decir que mComboEx, está definido como un CComboBoxEx.
Además tambien he llamadado a InitCommonControlsEx, tal y como dice la MSDN:
A ComboBoxEx control must be initialized by calling the InitCommonControlsEx function, specifying ICC_USEREX_CLASSES in the accompanying INITCOMMONCONTROLSEX structure
El código es el siguiente:
AtlInitCommonControls(ICC_COOL_CLASSES | ICC_BAR_CLASSES|ICC_USEREX_CLASSES );
Aún así sigo sin ver resultados, no soy capaz de insertar un solo elemento en el ComboBox.