CComboBox一选择就报断言错误,afxwin2.inl 767,求教!
.h里--->
#pragma once
#include "afxwin.h"
#include "afxcmn.h"
// CSetProxy 对话框
class CSetProxy : public CDialogEx
{
DECLARE_DYNAMIC(CSetProxy)
public:
CSetProxy(CWnd* pParent = NULL); // 标准构造函数
virtual ~CSetProxy();
// 对话框数据
enum { IDD = IDD_DIALOG4 };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
DECLARE_MESSAGE_MAP()
public:
CComboBox m_ProxyType;
afx_msg void OnBnClickedCheckdisplayuser();
public:
CButton b_CheckDisplayUser;
CString e_Username;
CString e_Psw;
int m_Port;
public:
afx_msg void OnCbnSelchangeProxytype();
public:
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
void iniProxyType();
public:
CIPAddressCtrl m_ServerAddress;
};
.cpp里--->
// SetProxy.cpp : 实现文件
//
#include "stdafx.h"
#include "kkclient.h"
#include "SetProxy.h"
// CSetProxy 对话框
IMPLEMENT_DYNAMIC(CSetProxy, CDialog)
CSetProxy::CSetProxy(CWnd* pParent /*=NULL*/)
: CDialogEx(CSetProxy::IDD, pParent)
, m_Port(0)
, e_Username(_T(""))
{
}
CSetProxy::~CSetProxy()
{
}
void CSetProxy::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CSetProxy, CDialog)
ON_BN_CLICKED(IDC_CHECKDISPLAYUSER, &CSetProxy::OnBnClickedCheckdisplayuser)
ON_CBN_SELCHANGE(IDC_PROXYTYPE, &CSetProxy::OnCbnSelchangeProxytype)
ON_WM_CREATE()
END_MESSAGE_MAP()
// CSetProxy 消息处理程序
void CSetProxy::OnBnClickedCheckdisplayuser()
{
}
void CSetProxy::OnCbnSelchangeProxytype()
{
}
void CSetProxy::iniProxyType()
{
//m_ProxyType.SetCurSel(0);
}
int CSetProxy::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDialogEx::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: 在此添加您专用的创建代码
return 0;
}
[解决办法]
绑定m_ProxyType 与你的ComBoBox控件ID..
void CSetProxy::DoDataExchange(CDataExchange* pDX)
{
DDX_Control(pDX, IDC_COMBO, m_ProxyType);
CDialog::DoDataExchange(pDX);
}