Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » CExtGridWnd derived class from a dll Collapse All
Subject Author Date
Jeremy Ruth Oct 22, 2008 - 10:34 AM

I have a CExtGridWnd derived class that I’d like to put into a custom dll and am having problems getting it to work.  Is there any trick to doing this type of thing?  It ASSERTs in the  AfxStaticDownCast routine in objcore.cpp (at line 62).   It happens within the following line of my code which is in my derived class.


CExtGridCellHeader * pCell = STATIC_DOWNCAST(CExtGridCellHeader,   GridCellGetOuterAtTop(i, 0L, RUNTIME_CLASS(CExtGridCellHeader)) );


I have an identical line of code prior to this line, which is not from the dll, that works fine.


All works fine when I do not try to export the derived class from a dll.

Technical Support Oct 23, 2008 - 2:03 PM

Please ensure your DLL project is MFC Extension DLL type - not MFC Regular DLL type. The regular DLLs cannot share C++ objects based on MFC classes with EXE’s MFC-based code. The regular DLLs have the theApp global variable of CWinApp-based type. The regular DLLs require MFC state switching based on the AFX_MANAGE_STATE preprocessor function. The extension DLLs should be used from MFC based EXE, can share objects with it and does not require MFC state switching. The extension DLLs were designed for extending MFC based EXE projects only nevertheless it’s possible to create special form of extension DLL which will extend regular DLL (RDE configurations of Prof-UIS for instance). It’s possible to load extension DLL dynamically, but you should use AfxLoadLibrary() API instead of LoadLibrary().