Click here to Skip to main content
15,886,547 members
Please Sign up or sign in to vote.
4.33/5 (2 votes)
Hello,

I have an application which works fine .

I have now made DLL of the classes which I use.In one of the classes
it has a statement which calls the ParentFrame and sets the menu.
GetParentFrame()->SetMenu(&FrameMenu);

But when I use DLL in my application I get an unhandled error where it seems that the Parent Frame is not found

What must be the problem?

When I debug he application with DLL the debug cursor does not enter inside the DLL's .cpp file .I want to enter the DLL code .What should be
done for that?


Pritha
Posted

1 solution

MFC has issues with multiple threads and possibly also with dlls. In this case GetParentFrame() is the culprit as it makes an internal call to CWnd::FromHandle which looks like this:

CWnd* PASCAL CWnd::FromHandle(HWND hWnd)<br />{<br />	CHandleMap* pMap = afxMapHWND(TRUE); //create map if not exist<br />	ASSERT(pMap != NULL);<br />	CWnd* pWnd = (CWnd*)pMap->FromHandle(hWnd);<br /><br />#ifndef _AFX_NO_OCC_SUPPORT<br />	pWnd->AttachControlSite(pMap);<br />#endif<br /><br />	ASSERT(pWnd == NULL || pWnd->m_hWnd == hWnd);<br />	return pWnd;<br />}<br />


The afxMapHWND func is probably trying to use global structures that aren't visible from the dll.

 
Share this answer
 


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900