Re: Why this happen? is it a bug of mfc9.0



Regular DLL

Now i find the error location.
this shoule be a bug of new mfc version.

In the CMFCVisualManagerOffice2007 ,when the style is changing , the
function SetStyle of CMFCVisualManagerOffice2007 auto call FreeLibrary to
free the dll, so the error happend.

Now i derived a class from CMFCVisualManagerOffice2007
and add a static function to set the member variable m_bAutoFreeRes , by
doing this the application can run correctly; see bellow.

class CMFCVisualExtManagerOffice2007 : public CMFCVisualManagerOffice2007
{
DECLARE_DYNCREATE(CMFCVisualExtManagerOffice2007)
public:
CMFCVisualExtManagerOffice2007();
virtual ~CMFCVisualExtManagerOffice2007();

static void SetAutoFreeRes(BOOL bAutoFree = FALSE)
{
m_bAutoFreeRes = bAutoFree;
}
};


.