afxwin1.inl ASSERT error in AfxGetResourceHandle()

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<span id="_ctl0_MainContent_PostFlatView <span>
<p class=MsoNormal style="margin:0in 0in 0pt <font face="Times New Roman My Visual C++ 05 MFC project serves as a framework that loads a variable series of MFC extension DLLs that do most of the work of the project.<span>  Although the DLLs vary widely in function and complexity, they have many common features and derive from a common base class.<span>  All of the DLLs export a configure() function.<span>  In most cases, the configuration is accomplished with a standard MFC dialog and associated class derived from CDialog.<span>  </font>
<p class=MsoNormal style="margin:0in 0in 0pt <font face="Times New Roman  </font>
<p class=MsoNormal style="margin:0in 0in 0pt <font face="Times New Roman The framework program and all DLL operations work properly when compiled in debug mode.<span>  When compiled in release mode, running under XP, the framework continues to operate properly, but all DLLs produce an assertion error on the DoModal() call to the configuration dialog.<span>  Presumably a call to any other DLL dialog will also show an error.  The call stack shows:</font>
<p class=MsoNormal style="margin:0in 0in 0pt <font face="Times New Roman <span>
</font>
<p class=MsoNormal style="margin:0in 0in 0pt <font face="Times New Roman <span>mfc80d.dll!CDialog:<img alt="Big Smile" src="http://forums.microsoft.com/MSDN/emoticons/emotion-2.gif oModal() Line 535 + 0x5 bytes (dlgcore.cpp)
</font>
<p class=MsoNormal style="margin:0in 0in 0pt <font face="Times New Roman <span>mfc80d.dll!AfxGetResourceHandle() Line 24 + 0x1e bytes (afxwin1.inl)</font>
<p class=MsoNormal style="margin:0in 0in 0pt
<font face="Times New Roman <span></font>
<p class=MsoNormal style="margin:0in 0in 0pt <font face="Times New Roman <span>in afxwin1.inl, the assertion that fails is ASSERT( afxCurrentResourceHandle != NULL )
</font>
<p class=MsoNormal style="margin:0in 0in 0pt
<font face="Times New Roman <span></font>
<p class=MsoNormal style="margin:0in 0in 0pt <font face="Times New Roman <span> I do a call to _heapchk() immediately before the DoModal() call that always returns _HEAPOK.<span>  Compiling with or without optimization has no effect.<span> 
</font>
<p class=MsoNormal style="margin:0in 0in 0pt
<font face="Times New Roman <span></font>
<p class=MsoNormal style="margin:0in 0in 0pt <font face="Times New Roman <span>Clearly the DLL resource handles are being properly initialized in the debug compilation but not in the release compilation. 
</font>
<p class=MsoNormal style="margin:0in 0in 0pt
<font face="Times New Roman <span></font>
<p class=MsoNormal style="margin:0in 0in 0pt <font face="Times New Roman <span>Searching the various forums shows that others have had similar issues, but I have found no clear discussion or solution.  Any suggestions?</font>
<p class=MsoNormal style="margin:0in 0in 0pt
<font face="Times New Roman <span></font>
<p class=MsoNormal style="margin:0in 0in 0pt <font face="Times New Roman <span>Thanks,</font>
<p class=MsoNormal style="margin:0in 0in 0pt
<font face="Times New Roman <span></font>
<p class=MsoNormal style="margin:0in 0in 0pt <font face="Times New Roman <span>SPZ
</font>

View the full article
 
Back
Top