Hello,
(Sorry for my bad english... i'll try my best :-))
I trying to manage a modeless dialog in a regular MFC DLL. I've created a new regular DLL-Project with the wizard. The Main-Dialog of the application (DLL) is the modeless dialog.
The Wizard created a Class CMyApp witch is derivated from CWinApp. This class contains only a Pointer to the modeless dialog (CMainDlg) and two Methods to mangage the Dialog:
- ShowGui()
- Close()
Code in ShowGui:
m_pMainDlg = new CMainDlg(m_pHardwareManage
r);
m_pMainWnd = m_pMainDlg;
m_pMainDlg->Create();
m_pMainDlg->ShowWindow(SW_
SHOW);
Code in CleanUp():
m_pMainWnd->DestroyWindow(
);
delete m_pMainWnd;
The Wizard created the one and only global object "theApp" and I export following two global methods:
- Show()
- Close()
Code in Show():
theApp.ShowGui();
Code in Close()
theApp.CleanUp();
My first question is, is this the right way to export a modeless dialog in a DLL or should I choose a other way?
The second question is why I always get an error if I call the Close(); Function. Every time i try to close the Dialog, my application crashes. I've also tried to send an WM_DESTROY message to the Dialog and i get the same problem. Where is the fault?
Thank you for reading!
Best regards
CKerberos
Start Free Trial