一个有关CComboBoxEx的简单问题

zjkw123 2004-03-18 10:33:38
COMBOBOXEXITEM item;
item.mask=CBEIF_TEXT;
item.pszText="one";
item.iItem=0;
m_boxex.InsertItem(&item);

m_boxex是通过ClassWizard添加的,再手动改成CComboBoxEx类型,
但是,InsertItem却返回-1,这几行哪里出问题了????
...全文
62 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
flinming 2004-03-19
  • 打赏
  • 举报
回复
typedef struct {
UINT mask;
int iItem;
LPTSTR pszText;
int cchTextMax;
int iImage;
int iSelectedImage;
int iOverlay;
int iIndent;
LPARAM lParam;
} COMBOBOXEXITEM, *PCOMBOBOXEXITEM;

Members
mask
Set of bit flags that specify attributes of this structure or of an operation that is using this structure. The flags specify members that are valid or must be filled in. This member can be a combination of the following values: Flag Description
CBEIF_DI_SETITEM Set this flag when processing CBEN_GETDISPINFO; the ComboBoxEx control will retain the supplied information and will not request it again.
CBEIF_IMAGE The iImage member is valid or must be filled in.
CBEIF_INDENT The iIndent member is valid or must be filled in.
CBEIF_LPARAM The lParam member is valid or must be filled in.
CBEIF_OVERLAY The iOverlay member is valid or must be filled in.
CBEIF_SELECTEDIMAGE The iSelectedImage member is valid or must be filled in.
CBEIF_TEXT The pszText member is valid or must be filled in.

iItem
Zero-based index of the item.
pszText
Address of a character buffer that contains or receives the item's text. If text information is being retrieved, this member must be set to the address of a character buffer that will receive the text. The size of this buffer must also be indicated in cchTextMax. If this member is set to LPSTR_TEXTCALLBACK, the control will request the information by using the CBEN_GETDISPINFO notification messages.
cchTextMax
Length of pszText, in characters. If text information is being set, this member is ignored.
iImage
Zero-based index of an image within the image list. The specified image will be displayed for the item when it is not selected. If this member is set to I_IMAGECALLBACK, the control will request the information by using CBEN_GETDISPINFO notification messages.
iSelectedImage
Zero-based index of an image within the image list. The specified image will be displayed for the item when it is selected. If this member is set to I_IMAGECALLBACK, the control will request the information by using CBEN_GETDISPINFO notification messages.
iOverlay
One-based index of an overlay image within the image list. If this member is set to I_IMAGECALLBACK, the control will request the information by using CBEN_GETDISPINFO notification messages.
iIndent
Number of indent spaces to display for the item. Each indentation equals 10 pixels. If this member is set to I_INDENTCALLBACK, the control will request the information by using CBEN_GETDISPINFO notification messages.
lParam
32-bit value specific to the item.
yaolan1999 2004-03-19
  • 打赏
  • 举报
回复
可能是改的不彻底,你在控件关联变量中选value后再选CComboBoxEx.

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧