在类中定义了。
public:
int sendportsel类构造函数中:
senportsel=0;OnInitDialog函数中:
((CComboBox*)GetDlgItem(IDC_COMBO_SENDCOM))->SetCurSel(sendportsel);让combobox控件响应CBN_SELCHANG消息
void CAutoRCDlg::OnSelchangeComboSendcom()
{
// TODO: Add your control notification handler code here
CString str="sss";
sendportsel=((CComboBox*)GetDlgItem(IDC_COMBO_SENDCOM))->GetCurSel();
sendportsel=+1;
str.Format("%d",sendportsel);
MessageBox(str);
}
但是消息框弹出的消息始终是1,请问事怎么回事。
public:
int sendportsel类构造函数中:
senportsel=0;OnInitDialog函数中:
((CComboBox*)GetDlgItem(IDC_COMBO_SENDCOM))->SetCurSel(sendportsel);让combobox控件响应CBN_SELCHANG消息
void CAutoRCDlg::OnSelchangeComboSendcom()
{
// TODO: Add your control notification handler code here
CString str="sss";
sendportsel=((CComboBox*)GetDlgItem(IDC_COMBO_SENDCOM))->GetCurSel();
sendportsel=+1;
str.Format("%d",sendportsel);
MessageBox(str);
}
但是消息框弹出的消息始终是1,请问事怎么回事。
解决方案 »
- sizeof(IOleObject)与sizeof(IOleObject *)一点疑问
- 如何新建一个进程序并随系统启动
- 如何从资源文件中加载位图?
- 【讨论】Winodws程序的调试
- ActiveX
- 关于VS2008编译器OnLButtonDown的问题
- webbrowser一问
- InternetGetConnectedState怎么用啊?
- 请问VTOOLSD所产生的代码如何在VC++中编译?
- :有必要去考大学的计算机研究生吗???
- 请问下有没有Web自动交互开发比较系统的书籍或者资料 我找了好多地方都没找到 webbrowser的资料我baidu了一下也就那么几篇... 但是看这里大家的发言讨论的内容好多 有没有比较全面的资料?
- 端口映射到域名的软件
仍然后m_combobox.GetCurSel()就ok了
sendportsel=((CComboBox*)GetDlgItem(IDC_COMBO_SENDCOM))->GetCurSel();
这种方法应该是和你说用control类型变量来控制的效果是一样的吧
CString str="sss";
sendportsel=((CComboBox*)GetDlgItem(IDC_COMBO_SENDCOM))->GetCurSel();
sendportsel=+1;
str.Format("%d",sendportsel);
MessageBox(str);
GetCurSel得不到正确的索引号
其它控件消息(比如按钮点击时)用GetCurSel方法得,能正确得出的