解決 Warning: calling DestroyWindow in CWnd::~CWnd OnDestroy or PostNcDestroy in derived class will not be called
出現上面Warning,原因是,呼叫視窗類析構的時候,視窗物件還沒有銷燬.
具體表現在,當在一個視窗中生成另外一個視窗CTestDlg 時:
CTestDlg *pTd = new CTestDlg();
pTd->Create(IDD_DIALOG_TEST,this);
pTd->ShowWindow(TREU):
//結束時
delete pTd;
pTd = NULL;
這樣的寫法就會出現上面的warning,正確的做法如下:
//結束時
if(pTd)
{
pTd->DestoryWindow();
pTd = NULL;
}
//在後生成的視窗類中加如下程式碼
void CTestDlg ::PostNcDestroy()
{
// TODO: 在此新增專用程式碼和/或呼叫基類
delete this;//這個一定要
CDialog::PostNcDestroy();
}
相關文章
- (轉)CWnd與HWND的區別與轉換
- onMounted is called when there is no active component 已解決
- "getActivePinia()" was called but there was no active Pinia. Are you trying to use a store before calling "app.use(pinia)"?APP
- [WARNING] warning: Class com.google.protobuf.Descriptors not found - continuing with a stub.GoUI
- 解決警告“ld: warning: directory not found for option”
- java.lang.IllegalStateException: getOutputStream() has already been called for this response解決方案JavaException
- [git]warning: LF will be replaced by CRLF in 解決辦法Git
- git warning: LF will be replaced by CRLF in 解決辦法Git
- sonar程式碼質量檢測告警“static“ base class members should not be accessed via derived types
- Activity生命週期onDestroy
- WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED解決方法REMIDE
- MYSQL錯誤程式碼:1248 Every derived table must have its own alias 解決MySql
- warning: LF will be replaced by CRLF in ** 的原因及解決辦法
- WARNING:Could not lower the asynch I/O limit 錯誤解決MIT
- Unable to generate a temporary class (result=1)解決方法
- jar檔案could not find the main class解決JARAI
- Warning: Cannot send session cookie - headers already sent 解決SessionCookieHeader
- 織夢提示dedecms error warning錯誤的解決方法Error
- 錯誤:Dx unsupported class file version 52.0(解決)
- PHP Warning: exec() has been disabled for security 問題解決辦法PHP
- 解決Vagrant報錯Warning: Authentication failure. Retrying問題AI
- Class詳解
- onDestroy方法被延時執行~事件事件
- 記錄 warning: CRLF will be replaced LF by in XXX 的解決辦法
- window下的git [GIT] warning: LF will be replaced by CRLF問題解決方法Git
- Could not initialize class sun.awt.X11GraphicsEnvironment解決方案
- 解決OBJC_CLASS_$_MBProgressHUD無法引用的問題OBJ
- WPF TreeView SelectedItemChanged called twiceView
- getOutputStream() has already been called
- PHP Warning:fopen出錯如何解決?PHP
- 解決 PHP Warning: Module 'modulename' already loaded in Unknown on line 0PHP
- Warning: $HADOOP_HOME is deprecated. hadoop解決方法補充版Hadoop
- Linux scp 提示"WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED" 的解決方案LinuxREMIDE
- Git:warning: CALF wilL be replaced by LF in xxxx 問題解決Git
- java.lang.IllegalArgumentException: Could not find class異常解決方式JavaException
- GIT add檔案報錯:git warning: LF would be replaced by CRLF 解決方案Git
- Warning: count(): Parameter must be an array or an object that implements Countable in line 302解決方法Object
- Starting sendmial: make: Warning: File 'virtusertable.db' has ..的解決辦法2