我在SettingDlg窗口中添加了CIPAddressCtrl控件,并用建立类向导为其添加一个成员变量m_CIPAddress.
SettingDlg dlg;
ulIpAddress = inet_addr("192.168.1.129");
dlg.m_CIPAddress.SetAddress(ulIpAddress );
然而但我运行到dlg.m_CIPAddress.SetAddress(ulIpAddress );的时候会弹出如下窗口:
-----------------------------------------------------------------------
file: afxcmn2.inl
line: 301
For information on how your program can cause an assertion failure,
see the visual c++ documentation on asserts.
-----------------------------------------------------------------------
好像只要我对m_CIPAddress这个进行操作,不管是什么样操作都会出错.
SettingDlg dlg;
ulIpAddress = inet_addr("192.168.1.129");
dlg.m_CIPAddress.SetAddress(ulIpAddress );
然而但我运行到dlg.m_CIPAddress.SetAddress(ulIpAddress );的时候会弹出如下窗口:
-----------------------------------------------------------------------
file: afxcmn2.inl
line: 301
For information on how your program can cause an assertion failure,
see the visual c++ documentation on asserts.
-----------------------------------------------------------------------
好像只要我对m_CIPAddress这个进行操作,不管是什么样操作都会出错.
((CIPAddessCtrl*)GetDlgItem(IDI_IPADDRESS1))->SetAddress()
Create一下就好了。
我执行dlg.m_CIPAddress.Create也会出错啊
你叫我怎么Create啊.
用你的方法依然出错啊
简单的方法就是dlg.DoModal();
并把
ulIpAddress = inet_addr("192.168.1.129");
m_CIPAddress.SetAddress(ulIpAddress );
放到SettingDlg类的OniInitDialog()里面去,注意要放在CDialog::InitDialog()之后