Advertisement

12.01.2008 at 12:52PM PST, ID: 23947985 | Points: 400
[x]
Attachment Details

MFC Regular-DLL: Modeless Dialog (Show / Close)

Asked by CKerberos in Windows MFC Programming, Microsoft Visual C++.Net, Microsoft Visual C++

Tags:

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_pHardwareManager);
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
[+][-]12.01.2008 at 01:09PM PST, ID: 23072398

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12.01.2008 at 11:08PM PST, ID: 23074938

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12.02.2008 at 06:32AM PST, ID: 23077082

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12.02.2008 at 09:08AM PST, ID: 23078724

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080924-EE-VQP-38 - Hierarchy / EE_QW_2_20070628