Braulio
March 31st, 1999, 04:28 AM
Hi,
I'm trying to insert items to a COMBOBOXEX control ( the combo from IE), but when I send the message the program stops
and gives me a nasty error, my code is:
BOOL CComboDlg::AddItems(HWND hwndCB)
{
COMBOBOXEXITEM cbei;
int iCnt;
typedef struct {
int iImage;
int iSelectedImage;
int iIndent;
LPSTR pszText;
} ITEMINFO, *pITEMINFO;
ITEMINFO IInf[]= {
{0,0,0,"First"},
{0,0,0,"Second"},
{0,0,0,"Third"},
{0,0,0,"Fourth"},
};
cbei.mask = CBEIF_TEXT;
for (iCnt = 0;iCnt<4;iCnt++) {
cbei.iItem = iCnt;
cbei.pszText = IInf[iCnt].pszText;
cbei.cchTextMax = sizeof(IInf[iCnt].pszText);
cbei.iImage = 0;
cbei.iSelectedImage = 0;
cbei.iIndent = 0 ;
if (::SendMessage(hwndCB,CBEM_INSERTITEM,0,(LPARAM)&cbei==-1)) return FALSE;
}
//::SendMessage(hwndCB,CBEM_SETIMAGELIST,0,(LPARAM) &m_smallImageList);
return TRUE;
}
How can I solve this ?, Thanks, Bye !
Braulio
I'm trying to insert items to a COMBOBOXEX control ( the combo from IE), but when I send the message the program stops
and gives me a nasty error, my code is:
BOOL CComboDlg::AddItems(HWND hwndCB)
{
COMBOBOXEXITEM cbei;
int iCnt;
typedef struct {
int iImage;
int iSelectedImage;
int iIndent;
LPSTR pszText;
} ITEMINFO, *pITEMINFO;
ITEMINFO IInf[]= {
{0,0,0,"First"},
{0,0,0,"Second"},
{0,0,0,"Third"},
{0,0,0,"Fourth"},
};
cbei.mask = CBEIF_TEXT;
for (iCnt = 0;iCnt<4;iCnt++) {
cbei.iItem = iCnt;
cbei.pszText = IInf[iCnt].pszText;
cbei.cchTextMax = sizeof(IInf[iCnt].pszText);
cbei.iImage = 0;
cbei.iSelectedImage = 0;
cbei.iIndent = 0 ;
if (::SendMessage(hwndCB,CBEM_INSERTITEM,0,(LPARAM)&cbei==-1)) return FALSE;
}
//::SendMessage(hwndCB,CBEM_SETIMAGELIST,0,(LPARAM) &m_smallImageList);
return TRUE;
}
How can I solve this ?, Thanks, Bye !
Braulio