做了个Dialog,没有用DoModal,采用无模式窗口。
可是执行完很快就退出了。
我希望它能保留在内存中,响应后面的事件。
谢谢大侠。我试者在App::InitInstance()中加入循环,但是效果不理想,而且不规范。
可是执行完很快就退出了。
我希望它能保留在内存中,响应后面的事件。
谢谢大侠。我试者在App::InitInstance()中加入循环,但是效果不理想,而且不规范。
m_pDlg.ShowWindow(SW_HIDE);没有用啊。
CSimpleSignal* m_pDlg=new CSimpleSignal ;
m_pDlg.Create(IDD_Signal_Simple);
m_pDlg.ShowWindow(SW_HIDE);
m_pDlg->Create(IDD_Signal_Simple);
m_pDlg->ShowWindow(SW_HIDE);
我用new没有任何改善。
还产生内存泄漏。
CSimpleSignal *m_pDlg;BOOL CCardConfigApp::InitInstance()
{
TRACE("\n\r\n\rInitInstance()\n\r"); AfxEnableControlContainer(); // Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif m_pDlg=new CSimpleSignal;
m_pDlg->Create(IDD_Signal_Simple);
m_pDlg->ShowWindow(SW_HIDE);
return FALSE;}
BOOL CSimpleSignal::DestroyWindow()
{
// TODO: Add your specialized code here and/or call the base class
TRACE("Destroy Windows Begin\n\r");
do
{
Sleep(100);
}
while(!m_Exit); if(m_Exit)
{
TRACE("Destroy Window Simple Signal Successful\n\r");
delete this;
return CDialog::DestroyWindow();
}
else
{
TRACE("Not Destroy Window\n\r");
return FALSE;
}
TRACE("Destroy Windows End\n\r");
}