非模态对话框不能创建多个
void CBusConDlg::OnGridDblClick(NMHDR *pNotifyStruct, LRESULT* pResult)
{
CStationMonitorDlg*pDlg = new CStationMonitorDlg();
pDlg->Create(IDD_STATION_MONITOR);
pDlg->ShowWindow(SW_SHOW);
}
在CStationMonitorDlg.cpp中添加void CStationMonitorDlg::OnCancel()
{
// TODO: 在此添加专用代码和/或调用基类
DestroyWindow();
}
void CStationMonitorDlg::PostNcDestroy()
{
// TODO: 在此添加专用代码和/或调用基类
CDialog::PostNcDestroy();
delete this;
}
我需要双击击每一个单元格都要出CStationMonitorDlg,但是双击了以后出现一个,关闭后再出没问题,出第二个就出错
断点在 pDlg->Create(IDD_STATION_MONITOR);
跟踪到wincore.cppvoid AFXAPI AfxHookWindowCreate(CWnd* pWnd)
{
_AFX_THREAD_STATE* pThreadState = _afxThreadState.GetData();
if (pThreadState->m_pWndInit == pWnd)
return;
if (pThreadState->m_hHookOldCbtFilter == NULL)
{
pThreadState->m_hHookOldCbtFilter = ::SetWindowsHookEx(WH_CBT,
_AfxCbtFilterHook, NULL, ::GetCurrentThreadId());
if (pThreadState->m_hHookOldCbtFilter == NULL)
AfxThrowMemoryException();
}
ASSERT(pThreadState->m_hHookOldCbtFilter != NULL);
ASSERT(pWnd != NULL);
ASSERT(pWnd->m_hWnd == NULL); // only do once 在此处
ASSERT(pThreadState->m_pWndInit == NULL); // hook not already in progress
pThreadState->m_pWndInit = pWnd;
}
这个错误应该是指针关联的窗口对象只能是一个吧!,我想弹出多个该怎么处理呢?求大家帮帮忙