我在一个非模态对话框中添加了一个下拉式组合框,现在已经实现了在组合框的编辑框中输入信息点击保存按钮后,输入的信息自动添加到组合框的列表中。但是我不知道如何才能实现每次对话框创建时在组合框的列表中能自动显示出以前组合框中添加的信息。我尝试着在非模态对话框关闭的函数中,用一个字符串数组类变量保存组合框中的信息,然后在对话框初始化函数中添加这些信息,但是实现不了,下面是部分代码。void CWEIHU::OnCloseDlg()
{
CStringArray strArray;
strArray.RemoveAll();
CString str1; for(int i=0;i<=m_comBox.GetCount()-1;i++)
{
CString str1;
m_comBox.GetLBText(i,str1); strArray.InsertAt(i,str1);
}
DestroyWindow();
}
BOOL CWEIHU::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here for(int i=0;i<=strArray.GetSize()-1;i++)
{
m_comBox.InsertString(i,strArray.GetAt(i));
}
UpdateData(FALSE); return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}哪位能指点一下,怎么样才能实现这个功能呢?
{
CStringArray strArray;
strArray.RemoveAll();
CString str1; for(int i=0;i<=m_comBox.GetCount()-1;i++)
{
CString str1;
m_comBox.GetLBText(i,str1); strArray.InsertAt(i,str1);
}
DestroyWindow();
}
BOOL CWEIHU::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here for(int i=0;i<=strArray.GetSize()-1;i++)
{
m_comBox.InsertString(i,strArray.GetAt(i));
}
UpdateData(FALSE); return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}哪位能指点一下,怎么样才能实现这个功能呢?
{
public:
CStringArray strArray;
}
然后在void CWEIHU::OnCloseDlg() 函数中这样子使用数组类
(CKaierApp*)AfxGetApp()->strArray.RemoveAll();
怎么报错说error C2039: 'strArray' : is not a member of 'CWinApp'
这是怎么回事呢?
优先级问题