在菜单View下添加选项test,test按下后弹出非模态对话框IDD_DIALOG1
在程序的View类中加入View/test的处理函数
class CCai1View : public CScrollView
{
// Attributes
public:
CModelless* m_pModelless;
}CCai1View::CCai1View()
{
m_pModelless=NULL;
}
void CCai1View::OnViewTest()
{
// TODO: Add your command handler code here
if(m_pModelless==NULL)
{
m_pModelless=new CModelless;
m_pModelless->Create(IDD_DIALOG1,this);
m_pModelless->ShowWindow(SW_SHOW);
}
else
m_pModelless->SetForegroundWindow();
}
当单击对话框IDD_DIALOG1中“确定”button后,我想这时删除指针m_pModelless,如何实现?
在程序的View类中加入View/test的处理函数
class CCai1View : public CScrollView
{
// Attributes
public:
CModelless* m_pModelless;
}CCai1View::CCai1View()
{
m_pModelless=NULL;
}
void CCai1View::OnViewTest()
{
// TODO: Add your command handler code here
if(m_pModelless==NULL)
{
m_pModelless=new CModelless;
m_pModelless->Create(IDD_DIALOG1,this);
m_pModelless->ShowWindow(SW_SHOW);
}
else
m_pModelless->SetForegroundWindow();
}
当单击对话框IDD_DIALOG1中“确定”button后,我想这时删除指针m_pModelless,如何实现?
void CModelless::OnOK()
{
DestroyWindow();
}
void CModelless::PostNcDestroy()
{
// TODO: Add your specialized code here and/or call the base class
delete this; CDialog::PostNcDestroy();
}
为什么还是不行呢?
{
delete m_pModelless;
}