1 声明一个你要弹出的对话框类的指针如:
CMsgDialog *pMsgDlg;
2.创建:
if(pMsgDlg==NULL)
{
pMsgDlg=new CMsgDialog;
pMsgDlg->Create(IDD_MSGDIALOG,this);
pMsgDlg->ShowWindow(SW_SHOW);
}
3,最后不要忘记删除:
if(pMsgDlg!=NULL)
{
delete pMsgDlg;
pMsgDlg=NULL;
}
CMsgDialog *pMsgDlg;
2.创建:
if(pMsgDlg==NULL)
{
pMsgDlg=new CMsgDialog;
pMsgDlg->Create(IDD_MSGDIALOG,this);
pMsgDlg->ShowWindow(SW_SHOW);
}
3,最后不要忘记删除:
if(pMsgDlg!=NULL)
{
delete pMsgDlg;
pMsgDlg=NULL;
}
try
{
strMyClass = AfxRegisterWndClass(
CS_VREDRAW | CS_HREDRAW,
::LoadCursor(NULL, IDC_ARROW),
(HBRUSH) ::GetStockObject(WHITE_BRUSH),
::LoadIcon(NULL, IDI_APPLICATION));
}
catch (CResourceException* pEx)
{
AfxMessageBox(
_T("Couldn't register class! (Already registered?)"));
pEx->Delete();
}if(quxian != NULL)
return TRUE;
quxian = new CzQuXian;
CRect rect(50,50,400,300);
quxian->CreateEx(WS_EX_CLIENTEDGE,
strMyClass, "hi",
WS_CHILD|WS_TABSTOP | WS_VISIBLE,
rect,
this,
1001);
quxian->ShowWindow(SW_SHOW);
其中CzQuXian为由cwnd派生的简单类,什么都没有重载。和CWnd一样。这样是在对话框中建立一个子类型(child)的窗口,可以通过,
但是我想建立一个弹出的窗口(popup),how to ?
Warning: calling DestroyWindow in CDialog::~CDialog --
OnDestroy or PostNcDestroy in derived class will not be called.
请问该怎么办?