15,978
社区成员
发帖
与我相关
我的任务
分享
CFrameWnd* p = new CFrameWnd;
ASSERT(p != NULL);
if (p->Create(NULL, NULL, WS_OVERLAPPEDWINDOW, CRect(0,0,0,0), this))
{
p->DestroyWindow();//内部会去delete
}
else
{
delete p;//窗口没创建需要delete
}
p = NULL;//赋值为空,避免野指针
void CFrameWnd::PostNcDestroy()
{
// default for frame windows is to allocate them on the heap
// the default post-cleanup is to 'delete this'.
// never explicitly call 'delete' on a CFrameWnd, use DestroyWindow instead
delete this;
}