关于win32 API combobox的应用
用createwindow的方法创建了一个combobox控件m_hWndMode=CreateWindow(TEXT("ComboBox"),NULL,WS_CHILD...
用createwindow的方法创建了一个combobox控件
m_hWndMode = CreateWindow(TEXT("ComboBox"),
NULL,
WS_CHILDWINDOW | WS_VISIBLE | LBS_STANDARD,
640, 210, 150, 80, m_parentHWnd,
(HMENU)IDCB_COMBOBOX_MODE,//(HMENU)(y << 8 | x),
(HINSTANCE)GetWindowLong(m_parentHWnd, GWL_HINSTANCE),
NULL);
然后用 SendMessage(m_hWndMode, CB_ADDSTRING, (WPARAM)0, (LPARAM)(LPCTSTR)TEXT("任务模式"));
SendMessage(m_hWndMode, CB_ADDSTRING, (WPARAM)0, (LPARAM)(LPCTSTR)TEXT("休闲模式"));
加了两个内容
求高手帮忙 怎么让combobox里面有初始选项? 怎么得到当前选项是哪个?
在线等 帮忙帮忙 展开
m_hWndMode = CreateWindow(TEXT("ComboBox"),
NULL,
WS_CHILDWINDOW | WS_VISIBLE | LBS_STANDARD,
640, 210, 150, 80, m_parentHWnd,
(HMENU)IDCB_COMBOBOX_MODE,//(HMENU)(y << 8 | x),
(HINSTANCE)GetWindowLong(m_parentHWnd, GWL_HINSTANCE),
NULL);
然后用 SendMessage(m_hWndMode, CB_ADDSTRING, (WPARAM)0, (LPARAM)(LPCTSTR)TEXT("任务模式"));
SendMessage(m_hWndMode, CB_ADDSTRING, (WPARAM)0, (LPARAM)(LPCTSTR)TEXT("休闲模式"));
加了两个内容
求高手帮忙 怎么让combobox里面有初始选项? 怎么得到当前选项是哪个?
在线等 帮忙帮忙 展开
展开全部
呵呵,为什么做这些没有用的东西。
使用这个消息
CB_SETCURSEL
wParam = (WPARAM) index; // item index
lParam = 0; // not used; must be zero
SendMessage(m_hWndMode, CB_SETCURSEL , 0, 0L);
CB_GETCURSEL //获取当前的索引
wParam = 0; // not used; must be zero
lParam = 0; // not used; must be zero
int id;
id =(int)SendMessage(m_hWndMode, CB_GETCURSEL , 0, 0L);
使用这个消息
CB_SETCURSEL
wParam = (WPARAM) index; // item index
lParam = 0; // not used; must be zero
SendMessage(m_hWndMode, CB_SETCURSEL , 0, 0L);
CB_GETCURSEL //获取当前的索引
wParam = 0; // not used; must be zero
lParam = 0; // not used; must be zero
int id;
id =(int)SendMessage(m_hWndMode, CB_GETCURSEL , 0, 0L);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询