|
Question : DLL created with AppWizard gives modal dialog; hand coded gives modeless !
|
|
Ah hello.
This is a continuation of the question at http:Q_21491163.html, in which I was asking about DLLs. The issue this question is concerned with is why a DLL created with AppWizard containing a call to .DoModal() creates a truly modal dialog, and a DLL hand coded with no AppWizard support creates a modeless one, when ***both DoModal() calls pass NULL as the parent***
hemakumar posted this:
>> If u take the appwizard support u must have seen the application object created globally and the framework links a default DllMain in the regulardll.When u call DoModal without passing ParentWindow the Frameowrk calls Internally AfxGetThread()->m_pMainWnd
I have traced through my code at the DoModal() call and cannot see where
AfxGetThread()->m_pMainWnd
is.
Can someone help me clarify this situation please ?
TIA
|
|
Answer : DLL created with AppWizard gives modal dialog; hand coded gives modeless !
|
|
So I can see what is happening, and why we get different parents, but why with the hand coded DLL, in AfxGetMainWnd(), does CWinThread* pThread = AfxGetThread();
return NULL
and with the AppWizard one return a valid CWinThread* ?
AfxGetThread() return NuLL for hand -coded dll because there is no application created in it.
CWinApp is derived from CWinThread.So when app object is created it is stored in a module state strcuture by framework.As there is no WinApp object for hand-code there is no app stored in module state and hence the problem.
Hope u followed it.
|
|
|
|