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 Tech Support » Unpredictable crash (ProfUIS 2.90) Collapse All
Subject Author Date
Tommaso Chiarelli Sep 23, 2010 - 12:30 PM

Hi,

As the post title says, the problem is about a kind of an unpredictable crash. Usually it happens while I’m using the application I work upon (it uses ProfUIS and ProfSkin dlls, in MBCS mode, dinamically). The crash is quite indeterministic, there’s nothing in particular that I do to cause it (at least, that I can notice), but it seems rather to occur after a while (6-8 minutes) I’m workin on the app. Now I’m able to make it happen simply re-doing the same things/operations continually for that amount of time, minute more minute less.

Additional Info: the crash occurs indipendently that I’m using my application in Debug or Release mode.

Analyzing the call stack, it seems the problem si related to ProfUIS, but it’s not always the same every time (call stacks differ).

In order to show you the problem, I’ve taken down two crash occurences. The error message (for both the occurrences) is the following:

Eccezione non gestita di tipo ’System.Runtime.InteropServices.SEHException’ in DentalVox.exe

Informazioni aggiuntive: Eccezione lanciata da un componente esterno.

That in english should be something like:
Unhandled exception of  type ’System.Runtime.InteropServices.SEHException’ in DentalVox.exe

Additional information: Exception thrown by an external component.

The following reports, instead, are the call stack and the code strips involved by the calls respectively for the first and the second occurence.

NB: I prepared the "involved code strips reports" starting from the first relevant call (down) towards the last one (up), linking the steps with vertical up-pointed arrows, and highlighting the involved rows with horizontal right-pointd arrows. I’ve also added some notes about variables values where I thought it was important.

First occurence call stack:
 	kernel32.dll!7c812afb() 	
 	[I frame indicati di seguito possono essere errati e/o mancanti, non sono stati caricati simboli per kernel32.dll]	
 	kernel32.dll!7c812afb() 	
 	ntdll.dll!7c9257c1() 	
 	ntdll.dll!7c925239() 	
 	mfc80d.dll!CThreadSlotData::GetThreadValue(int nSlot=-529697949)  Riga 265	C++
 	msvcr80d.dll!_CxxThrowException(void * pExceptionObject=0x0012c5a0, const _s__ThrowInfo * pThrowInfo=0x783c6588)  Riga 166	C++
 	mfc80d.dll!AfxThrowResourceException()  Riga 1392	C++
 	mfc80d.dll!CWindowDC::CWindowDC(CWnd * pWnd=0x00000000)  Riga 1059	C++
> 	ProfUIS290md.dll!CExtPaintManager::stat_GetBPP()  Riga 5895	C++
	ProfUIS290md.dll!CExtPopupBaseWnd::_InitAnimation()  Riga 5181	C++
 	ProfUIS290md.dll!CExtPopupBaseWnd::CExtPopupBaseWnd()  Riga 5064	C++
 	ProfUIS290md.dll!CExtPopupMenuTipWnd::CExtPopupMenuTipWnd()  Riga 6575	C++
 	ProfUIS290md.dll!CExtNcFrameImpl::CExtNcFrameImpl()  Riga 495	C++
 	ProfUIS290md.dll!CExtNCW<CExtResizableDialog>::CExtNCW<CExtResizableDialog>()  Riga 564	C++
 	ProfUIS290md.dll!CExtMsgBox::CExtMsgBox(HWND__ * hWndParent=0x000f07d6, const char * strMessageText=0x0012d844, const char * strCaption=0x0059332c, unsigned int nMsgBoxStyle=16, unsigned int nHelpID=0, const char * strUniqueID=0x00000000, unsigned int nMsgBoxStyleEx=0)  Riga 8806	C++
 	ProfUIS290md.dll!CExtMsgBox::DoMsgBox(HWND__ * hWndParent=0x000f07d6, const char * strMessageText=0x0012d844, const char * strCaption=0x0059332c, unsigned int nMsgBoxStyle=16, unsigned int nHelpID=0, const char * strUniqueID=0x00000000, unsigned int nMsgBoxStyleEx=0, unsigned int nTimeoutSeconds=0, bool bIsDisabledTimeout=false, CExtBitmap * pBmpIcon=0x00000000)  Riga 9899	C++
 	ProfUIS290md.dll!ProfUISMsgBox(HWND__ * hWndParent=0x000f07d6, const char * strMessageText=0x0012d844, const char * strCaption=0x0059332c, unsigned int nMsgBoxStyle=16, unsigned int nHelpID=0, const char * strUniqueID=0x00000000, unsigned int nMsgBoxStyleEx=0, unsigned int nTimeoutSeconds=0, bool bIsDisabledTimeout=false, CExtBitmap * pBmpIcon=0x00000000)  Riga 9955	C++
 	[Codice esterno]	
 	DentalVox.exe!CDentalVoxApp::DoMessageBox(char* lpszPrompt = 0x0012D844, unsigned int nType = 16, unsigned int nIDPrompt = 0) Riga 38	C++
 	[Codice esterno]	
 	mfc80d.dll!AfxMessageBox(const char * lpszText=0x0012d844, unsigned int nType=16, unsigned int nIDHelp=0)  Riga 148	C++
 	mfc80d.dll!CException::ReportError(unsigned int nType=16, unsigned int nError=61704)  Riga 113	C++
 	mfc80d.dll!CWinApp::ProcessWndProcException(CException * e=0x783eb2a8, const tagMSG * pMsg=0x0015cda4)  Riga 977	C++
 	mfc80d.dll!AfxProcessWndProcException(CException * e=0x783eb2a8, const tagMSG * pMsg=0x0015cda4)  Riga 214	C++
 	mfc80d.dll!AfxCallWndProc(CWnd * pWnd=0x06cf6e28, HWND__ * hWnd=0x00170776, unsigned int nMsg=513, unsigned int wParam=1, long lParam=16974059)  Riga 248	C++
 	mfc80d.dll!AfxWndProc(HWND__ * hWnd=0x00170776, unsigned int nMsg=513, unsigned int wParam=1, long lParam=16974059)  Riga 389	C++
 	mfc80d.dll!AfxWndProcBase(HWND__ * hWnd=0x00170776, unsigned int nMsg=513, unsigned int wParam=1, long lParam=16974059)  Riga 407	C++
 	user32.dll!7e398734() 	
 	user32.dll!7e398816() 	
 	user32.dll!7e3aa013() 	
 	user32.dll!7e3aa039() 	
 	opengl32.dll!5f16699b() 	
 	mfc80d.dll!CThreadLocalObject::GetData(CNoTrackObject * (void)* pfnCreateObject=0x5f166780)  Riga 419	C++
 	user32.dll!7e398816() 	
 	user32.dll!7e3989cd() 	
 	user32.dll!7e3996c7() 	
 	mfc80d.dll!AfxInternalPumpMessage()  Riga 183	C++
 	mfc80d.dll!CWinThread::PumpMessage()  Riga 896	C++
 	mfc80d.dll!CWinThread::Run()  Riga 625	C++
 	mfc80d.dll!CWinApp::Run()  Riga 889	C++
 	mfc80d.dll!AfxWinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x00151f26, int nCmdShow=5)  Riga 47	C++
 	DentalVox.exe!WinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x00151f26, int nCmdShow=5)  Riga 29	C++
 	DentalVox.exe!__tmainCRTStartup()  Riga 578	C
 	DentalVox.exe!WinMainCRTStartup()  Riga 403	C
 	mfc80d.dll!AfxMessageBox(const char * lpszText=0x0012d844, unsigned int nType=16, unsigned int nIDHelp=0)  Riga 148	C++
 	mfc80d.dll!CException::ReportError(unsigned int nType=16, unsigned int nError=61704)  Riga 113	C++
 	mfc80d.dll!CWinApp::ProcessWndProcException(CException * e=0x783eb2a8, const tagMSG * pMsg=0x0015cda4)  Riga 977	C++
 	mfc80d.dll!AfxProcessWndProcException(CException * e=0x783eb2a8, const tagMSG * pMsg=0x0015cda4)  Riga 214	C++
 	mfc80d.dll!AfxCallWndProc(CWnd * pWnd=0x06cf6e28, HWND__ * hWnd=0x00170776, unsigned int nMsg=513, unsigned int wParam=1, long lParam=16974059)  Riga 248	C++
 	mfc80d.dll!AfxWndProc(HWND__ * hWnd=0x00170776, unsigned int nMsg=513, unsigned int wParam=1, long lParam=16974059)  Riga 389	C++
 	mfc80d.dll!AfxWndProcBase(HWND__ * hWnd=0x00170776, unsigned int nMsg=513, unsigned int wParam=1, long lParam=16974059)  Riga 407	C++
 	user32.dll!7e398734() 	
 	user32.dll!7e398816() 	
 	user32.dll!7e3aa013() 	
 	user32.dll!7e3aa039() 	
 	opengl32.dll!5f16699b() 	
 	mfc80d.dll!CThreadLocalObject::GetData(CNoTrackObject * (void)* pfnCreateObject=0x5f166780)  Riga 419	C++
 	user32.dll!7e398816() 	
 	user32.dll!7e3989cd() 	
 	user32.dll!7e3996c7() 	
 	mfc80d.dll!AfxInternalPumpMessage()  Riga 183	C++
 	mfc80d.dll!CWinThread::PumpMessage()  Riga 896	C++
 	mfc80d.dll!CWinThread::Run()  Riga 625	C++
 	mfc80d.dll!CWinApp::Run()  Riga 889	C++
 	mfc80d.dll!AfxWinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x00151f26, int nCmdShow=5)  Riga 47	C++
 	DentalVox.exe!WinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x00151f26, int nCmdShow=5)  Riga 29	C++
 	DentalVox.exe!__tmainCRTStartup()  Riga 578	C
 	DentalVox.exe!WinMainCRTStartup()  Riga 403	C
 	ntdll.dll!7c937784() 	
 	ntdll.dll!7c937573() 	
 	ntdll.dll!7c92005d() 	
 	ntdll.dll!7c91dc1a() 	
 	ntdll.dll!7c92005d() 	
 	ntdll.dll!7c92005d() 	
 	ntdll.dll!7c937784() 	
 	ntdll.dll!7c937573() 	
 	ntdll.dll!7c927ef3() 	
 	ntdll.dll!7c920385() 	
 	ntdll.dll!7c927dba() 	
 	ntdll.dll!7c927e5f() 	
 	ntdll.dll!7c927e09() 	
 	ntdll.dll!7c927e09() 	
 	ntdll.dll!7c927ec0() 	
 	ntdll.dll!7c946f38() 	
 	mscoree.dll!7900b77b() 	
 	ntdll.dll!7c9201db() 	
 	mscoree.dll!7900b73d() 	
 	mscoree.dll!79004de3() 	
 	ntdll.dll!7c9201db() 	
 	kernel32.dll!7c817077() 	
 	ntdll.dll!7c946f38() 	
 	ntdll.dll!7c9201db() 


First occurence involved code strips:
afxtls.cpp

inline void* CThreadSlotData::GetThreadValue(int nSlot)
{
	EnterCriticalSection(&m_sect);
	ASSERT(nSlot != 0 && nSlot < m_nMax);
	ASSERT(m_pSlotData != NULL);
	ASSERT(m_pSlotData[nSlot].dwFlags & SLOT_USED);
	ASSERT(m_tlsIndex != (DWORD)-1);
	if( nSlot <= 0 || nSlot >= m_nMax ) // check for retail builds.
	{
		LeaveCriticalSection(&m_sect);
		return NULL;
	}

	CThreadData* pData = (CThreadData*)TlsGetValue(m_tlsIndex);
	if (pData == NULL || nSlot >= pData->nCount)
	{
		LeaveCriticalSection(&m_sect);
		return NULL;
	}
	void* pRetVal = pData->pData[nSlot];
	LeaveCriticalSection(&m_sect);
=>	return pRetVal;
}

ˆ
|

wingdi.cpp

CWindowDC::CWindowDC(CWnd* pWnd)
{
	ASSERT(pWnd == NULL || ::IsWindow(pWnd->m_hWnd));

	if (!Attach(::GetWindowDC(m_hWnd = pWnd->GetSafeHwnd())))
		AfxThrowResourceException();
=>}

ˆ
|

extpaintmanager2.cpp

int CExtPaintManager::stat_GetBPP()
{
	CWindowDC dc_desktop( NULL );
=>	int nBitsPerPixel = ::GetDeviceCaps( dc_desktop.m_hDC, BITSPIXEL );
	return nBitsPerPixel;
}

ˆ
|

extpopupmenuwnd.cpp

void CExtPopupBaseWnd::_InitAnimation()
{
	ASSERT_VALID( this );

	m_nAnimPercent = m_nAnimPercentOld = 0;

	_AdjustAnimation( m_AnimationType );

	if(		(	m_AnimationType < 0
			||	m_AnimationType > __AT_MAX_VALID_VALUE
			)
		&&	m_AnimationType != __AT_CONTENT_DISPLAY
		&&	m_AnimationType != __AT_CONTENT_EXPAND
		)
		m_AnimationType = __AT_NONE;

	if( m_AnimationType == __AT_RANDOM )
	{
		int nRand = rand() % (__AT_MAX_VALID_VALUE+1);
		ASSERT( nRand >= 0 && nRand <= __AT_MAX_VALID_VALUE );
		if( nRand == __AT_NONE || nRand == __AT_RANDOM )
			nRand = __AT_FADE; // most cool of all effects
		m_AnimationType = (e_animation_type_t)nRand;
	}


=>	int nBitsPerPixel = CExtPaintManager::stat_GetBPP();
	if(		nBitsPerPixel <= 8
		&&	m_AnimationType != __AT_CONTENT_EXPAND
		&&	m_AnimationType != __AT_CONTENT_DISPLAY
		)
	{
		m_AnimationType = __AT_NONE;
		m_bAnimFinished = true;
	}

	else
	{
		m_bAnimFinished =
			(m_AnimationType == __AT_NONE) ? true : false;
	}

//	ASSERT(
//			m_bmpScreenDst.GetSafeHandle() == NULL
//		&&	m_bmpScreenSrc.GetSafeHandle() == NULL
//		&&	m_bmpScreenTmp.GetSafeHandle() == NULL
//		&&	m_clrFadeBitsSrc == NULL
//		&&	m_clrFadeBitsDst == NULL
//		&&	m_clrFadeBitsTmp == NULL
//		);
	if( m_bmpScreenDst.GetSafeHandle() != NULL )
		m_bmpScreenDst.DeleteObject();
	if( m_bmpScreenSrc.GetSafeHandle() != NULL )
		m_bmpScreenSrc.DeleteObject();
// 	if( m_bmpScreenSrcAlt.GetSafeHandle() != NULL )
// 		m_bmpScreenSrcAlt.DeleteObject();
	if( m_bmpScreenTmp.GetSafeHandle() != NULL )
		m_bmpScreenTmp.DeleteObject();
	m_clrFadeBitsSrc = NULL;
	m_clrFadeBitsDst = NULL;
	m_clrFadeBitsTmp = NULL;
	
}


ˆ
|

extpopupmenuwnd.cpp

CExtPopupBaseWnd::CExtPopupBaseWnd()
	: m_bPrintState( false )
	, m_eCombineAlign( __CMBA_NONE )
	, m_hFont( NULL )
{
	m_clrFadeBitsSrc
		= m_clrFadeBitsDst
		= m_clrFadeBitsTmp
		= NULL;
	m_AnimationType = g_DefAnimationType;
	_InitAnimation();
	m_ePlaySoundOnAnimationFinished =
=>		CExtSoundPlayer::__NO_SOUND;

	m_sizeFullItems.cx = m_sizeFullItems.cy = 1;

	m_bExcludeAreaSpec
		= m_bCombineWithEA
		= false;
	m_rcExcludeArea.SetRectEmpty();
	m_ptTrack.x = m_ptTrack.y
		= m_ptTrackOriginal.x = m_ptTrackOriginal.y
		= m_ptTrackInvoked.x = m_ptTrackInvoked.y
		= m_ptTrackWatched.x = m_ptTrackWatched.y
		= 0;

	PmBridge_Install();
}

ˆ
|

extpopupmenuwnd.cpp

CExtPopupMenuTipWnd::CExtPopupMenuTipWnd()
	: m_bFlipHorz( false )
	, m_bFlipVert( false )
	, m_sizeClassicMargins( 3, 2 )
	, m_sizeRounders( 12, 10 )
	, m_sizeLeader( 25, 25 )
	, m_nIconMarginDX( 5 )
	, m_nBalloonDistance( 12 )
	, m_nClassicDistance( 13 )
	, m_eTS( CExtPopupMenuTipWnd::__ETS_BALLOON )
	, m_nSizeShadow( -1 )
	, m_ttLA( 0 )
	, m_bPassiveMode( false )
	, m_bDelayedLayeredBehavior( false )
	, m_ptGuideLines( -32767, -32767 )
	, m_nTransparencyKey( BYTE(0x0FF) )
	, m_rcAlignment( 0, 0, 0, 0 )
	, m_nPeriodDelayShowQuick( ID_PERIOD_DELAY_SHOW_QUICK )
	, m_nPeriodDelayShowNormal( ID_PERIOD_DELAY_SHOW_NORMAL )
	, m_hWndLastParent( NULL )
	, m_bNoHideDetection( false )
=>{
	m_AnimationType = __AT_NONE;
	m_bAnimFinished = true;

ˆ
|

extncframe.cpp

CExtNcFrameImpl::CExtNcFrameImpl()
	: m_bNcFrameImpl_PivotPmSyncMode( false )
	, m_bNcFrameImpl_IsActive( false )
	, m_bNcFrameImpl_RgnSet( false )
	, m_bNcFrameImpl_RestoreBorder( false )
	, m_bNcFrameImpl_DelatayedFrameRecalc( false )
	, m_bNcFrameImpl_IsEnabled( true )
	, m_bNcFrameImpl_IsDwmBased( true )
	, m_bNcFrameImpl_Resizing( true )
	, m_bNcFrameImpl_Moving( true )
	, m_bNcFrameImpl_ResizingLoopTracking( false )
	, m_bNcFrameImpl_MovingLoopTracking( false )
	, m_bNcFrameImpl_QuickWindowPlacement( false )
	, m_rcNcFrameImpl_ScClose( 0, 0, 0, 0 )
	, m_rcNcFrameImpl_ScMaximize( 0, 0, 0, 0 )
	, m_rcNcFrameImpl_ScMinimize( 0, 0, 0, 0 )
	, m_rcNcFrameImpl_ScHelp( 0, 0, 0, 0 )
	, m_rcNcFrameImpl_Text( 0, 0, 0, 0 )
	, m_rcNcFrameImpl_Icon( 0, 0, 0, 0 )
	, m_nNcFrameImpl_ScTrackedButtonHover( 0 )
	, m_nNcFrameImpl_ScTrackedButtonPressed( 0 )
	, m_strNcFrameImpl_TipMinimize( _T("") )
	, m_strNcFrameImpl_TipMaximize( _T("") )
	, m_strNcFrameImpl_TipRestore( _T("") )
	, m_strNcFrameImpl_TipClose( _T("") )
	, m_strNcFrameImpl_TipHelp( _T("") )
	, m_dwNcFrameImpl_StyleInitial( 0 )
	, m_dwNcFrameImpl_StyleExInitial( 0 )
	, m_nNcFrameImpl_Lock( 0 )
	, m_nNcFrameImpl_LastCheckCursorHT( HTNOWHERE )
	, m_ptNcFrameImpl_LastCheckCursor( -32767, -32767 )
	, m_pNcFrameImplBridge( NULL )
	, m_bNcFrameImpl_HelperInsideNcHitTest( false )
	, m_bNcFrameImpl_RestoreEnabledState( false )
	, m_nNcFrameImpl_LastShowCmd( SW_HIDE )
	, m_bNcFrameImpl_NcInitPassed( false )
	, m_nNcFrameImpl_LastExternalNcHT( UINT(-1) )
	, m_rcNcFrameImpl_LastExternalNcHT( -1, -1, -1, -1 )
	, m_bNcFrameImpl_DwmSurfaceInitializationComplete( false )
	, m_bNcFrameImpl_CreatePassed( false )
	, m_bNcFrameImpl_AssigningRGN( false )
	, m_bNcFrameImpl_InAdjustAdjustThemeSettings( false )
=>{
	::memset( &m_NcFrameImpl_MinMaxInfo_Cache, 0, sizeof(MINMAXINFO) );
	m_BridgeNC.NcFrameImpl_Set( this );
	m_wndNcFrameImpl_Tip.SetTipStyle( CExtPopupMenuTipWnd::__ETS_RECTANGLE_NO_ICON );
	m_wndNcFrameImpl_Tip.SetShadowSize( 0 );
}

ˆ
|

extncframe.h

template < >
class CExtNCW < CExtResizableDialog >
	: public CExtResizableDialog
	, public CExtNcFrameImpl
{
public:
=>	CExtNCW()
	{
	}

ˆ
|

extcontrolscommon.cpp

CExtMsgBox::CExtMsgBox(
	HWND hWndParent,
	__EXT_MFC_SAFE_LPCTSTR strMessageText,
	__EXT_MFC_SAFE_LPCTSTR strCaption, // = NULL
	UINT nMsgBoxStyle, // = __EXT_MB_DEFAULT_STYLES
	UINT nHelpID, // = 0
	__EXT_MFC_SAFE_LPCTSTR strUniqueID, // = NULL // for __EXT_MB_DO_NOT_DISPLAY_AGAIN and __EXT_MB_DO_NOT_ASK_AGAIN
	UINT nMsgBoxStyleEx // = __EXT_MB_EX_DEFAULT_STYLES
	)
	: m_wndEditMsgBoxMessageText( true )
	, m_hWndParentFromCTOR( hWndParent )
	, m_strMessageText( ( strMessageText == NULL ) ? _T("") : LPCTSTR(strMessageText) )
	, m_strCaption( ( strCaption == NULL || _tcslen(strCaption) == 0 ) ? LPCTSTR( ::AfxGetAppName() ) : LPCTSTR(strCaption) )
	, m_nMsgBoxStyle( nMsgBoxStyle )
	, m_nMsgBoxStyleEx( nMsgBoxStyleEx )
	, m_nHelpID( nHelpID )
	, m_nTimeoutSeconds( 0 )
	, m_bIsDisabledTimeout( false )
	, m_nTimeoutTimer( 0 )
	, m_nDefaultButtonDlgCtrlID( UINT(IDC_STATIC) )
	, m_nEscapeButtonDlgCtrlID( UINT(IDC_STATIC) )
	, m_sizeMessageText( 0, 0 )
	, m_sizeCheckBox( 0, 0 )
	, m_sizeButton( 0, 0 )
	, m_strUniqueID( LPCTSTR(strUniqueID) != NULL ? LPCTSTR(strUniqueID) : _T("") ) // for __EXT_MB_DO_NOT_DISPLAY_AGAIN and __EXT_MB_DO_NOT_ASK_AGAIN
	, m_sizeBorder( __EXT_MSG_BOX_DEFAULT_WINDOW_BORDER_WIDTH, __EXT_MSG_BOX_DEFAULT_WINDOW_BORDER_HEIGHT )
	, m_sizeStdButton( __EXT_MSG_BOX_DEFAULT_BUTTON_WIDTH, __EXT_MSG_BOX_DEFAULT_BUTTON_HEIGHT )
	, m_sizeStdButtonBorder( __EXT_MSG_BOX_DEFAULT_BUTTON_BORDER_WIDTH, __EXT_MSG_BOX_DEFAULT_BUTTON_BORDER_HEIGHT )
	, m_nCheckBoxGap( __EXT_MSG_BOX_CHECK_BOX_ADDITIONAL_SPACE )
	, m_nButtonSpace( __EXT_MSG_BOX_BTN_SPACE )
	, m_nMinEditCtrlHeight( __EXT_MSG_BOX_DEFAULT_EDITOR_MIN_HEIGHT_PX )
	, m_nMaxEditCtrlHeight( __EXT_MSG_BOX_DEFAULT_EDITOR_MAX_HEIGHT_PX )
	, m_bDynamicIcon( false )
	, m_clrEditorText( __EXT_MSG_BOX_DEFAULT_EDITOR_COLOR_TEXT )
	, m_clrEditorBkgnd( __EXT_MSG_BOX_DEFAULT_EDITOR_COLOR_BKGND )
=>{
	_AddDefaultIconStyle();
	SetAutoSubclassChildControls();
}

ˆ
|

extcontrolscommon.cpp

int CExtMsgBox::DoMsgBox(
	HWND hWndParent,
	__EXT_MFC_SAFE_LPCTSTR strMessageText,
	__EXT_MFC_SAFE_LPCTSTR strCaption, // = NULL
	UINT nMsgBoxStyle, // = __EXT_MB_DEFAULT_STYLES
	UINT nHelpID, // = 0
	__EXT_MFC_SAFE_LPCTSTR strUniqueID, // = NULL // for __EXT_MB_DO_NOT_DISPLAY_AGAIN and __EXT_MB_DO_NOT_ASK_AGAIN
	UINT nMsgBoxStyleEx, // = __EXT_MB_EX_DEFAULT_STYLES
	UINT nTimeoutSeconds, // = 0
	bool bIsDisabledTimeout, // = false
	CExtBitmap * pBmpIcon // = NULL
	)
{
__PROF_UIS_MANAGE_STATE;
	if( ::GetCapture() != NULL )
		::ReleaseCapture(); // force release mouse capture
=>	CExtMsgBox dlg( hWndParent, strMessageText, strCaption, nMsgBoxStyle, nHelpID, strUniqueID, nMsgBoxStyleEx );
	if( nTimeoutSeconds > 0 )
		dlg.TimeoutSet( nTimeoutSeconds, bIsDisabledTimeout );
	if( pBmpIcon != NULL && ( ! pBmpIcon->IsEmpty() ) )
		dlg.m_bmpIcon = (*pBmpIcon);
//HWND hWndFocusRestore = ::GetFocus();
int nRetVal = int( dlg.DoModal() );
//	if(		hWndFocusRestore != NULL
//		&&	::IsWindow( hWndFocusRestore )
//		&&	::IsWindowEnabled( hWndFocusRestore )
//		&&	( ( ::__EXT_MFC_GetWindowLong( hWndFocusRestore, GWL_STYLE ) ) & WS_VISIBLE ) != 0
//		&&	::GetFocus() != hWndFocusRestore
//		)
//	{
//		CExtPopupMenuWnd::PassMsgLoop( false );
//		if(		::IsWindow( hWndFocusRestore )
//			&&	::IsWindowEnabled( hWndFocusRestore )
//			&&	( ( ::__EXT_MFC_GetWindowLong( hWndFocusRestore, GWL_STYLE ) ) & WS_VISIBLE ) != 0
//			&&	::GetFocus() != hWndFocusRestore
//			)
//			::SetFocus( hWndFocusRestore );
//	}
	return nRetVal;
}

ˆ
|

extcontrolscommon.cpp

int ProfUISMsgBox(
	HWND hWndParent,
	__EXT_MFC_SAFE_LPCTSTR strMessageText,
	__EXT_MFC_SAFE_LPCTSTR strCaption, // = NULL
	UINT nMsgBoxStyle, // = __EXT_MB_DEFAULT_STYLES
	UINT nHelpID, // = 0
	__EXT_MFC_SAFE_LPCTSTR strUniqueID, // = NULL // for __EXT_MB_DO_NOT_DISPLAY_AGAIN and __EXT_MB_DO_NOT_ASK_AGAIN
	UINT nMsgBoxStyleEx, // = __EXT_MB_EX_DEFAULT_STYLES
	UINT nTimeoutSeconds, // = 0
	bool bIsDisabledTimeout, // = false
	CExtBitmap * pBmpIcon // = NULL
	)
{
__PROF_UIS_MANAGE_STATE;
=>	return CExtMsgBox::DoMsgBox( hWndParent, strMessageText, strCaption, nMsgBoxStyle, nHelpID, strUniqueID, nMsgBoxStyleEx, nTimeoutSeconds, bIsDisabledTimeout, pBmpIcon );
}

ˆ
|

DentalVox.h

class CDentalVoxApp : public CWinApp
{
public:
=>	IMPLEMENT_CWinAPP_DoMessageBox;
	CDentalVoxApp();
	~CDentalVoxApp();


Second occurrence call stack:
 	ntdll.dll!7c91120e() 	
 	[I frame indicati di seguito possono essere errati e/o mancanti, non sono stati caricati simboli per ntdll.dll]	
 	msvcr80d.dll!_CrtDbgBreak()  Riga 89	C
 	msvcr80d.dll!_VCrtDbgReportA(int nRptType=2, const char * szFile=0x01a4bcf0, int nLine=4859, const char * szModule=0x00000000, const char * szFormat=0x00000000, char * arglist=0x001238b4)  Riga 295	C
 	msvcr80d.dll!_CrtDbgReportV(int nRptType=2, const char * szFile=0x01a4bcf0, int nLine=4859, const char * szModule=0x00000000, const char * szFormat=0x00000000, char * arglist=0x001238b4)  Riga 300	C
 	msvcr80d.dll!_CrtDbgReport(int nRptType=2, const char * szFile=0x01a4bcf0, int nLine=4859, const char * szModule=0x00000000, const char * szFormat=0x00000000, ...)  Riga 317	C
	mfc80d.dll!AfxAssertFailedLine(const char * lpszFileName=0x01a4bcf0, int nLine=4859)  Riga 25	C++
> 	ProfUIS290md.dll!CExtBitmap::DrawSkinParts(HDC__ * hDC=0x00000000, const tagRECT & rcDstDraw={...}, const tagRECT & rcPadding={...}, CExtBitmap::e_DrawMethod_t eDM=__EDM_STRETCH, bool bDrawMiddlePart=true, bool bSmootherAsPossible=false, unsigned long dwRop=13369376)  Riga 4859	C++
 	ProfUIS290md.dll!CExtPaintManagerOffice2007_Impl::StatusBar_EraseBackground(CDC & dc={...}, const tagRECT & rcClient={...}, const CExtStatusControlBar * pStatusBar=0x0725e470, long lParam=0)  Riga 28383	C++
 	ProfUIS290md.dll!CExtStatusControlBar::OnPaintEntireBackground(CDC & dc={...}, const CRect & rcBk={...})  Riga 413	C++
 	ProfUIS290md.dll!CExtStatusControlBar::DoPaint(CDC * pDC=0x00123bc0)  Riga 195	C++
 	ProfUIS290md.dll!CExtStatusControlBar::OnPaint()  Riga 166	C++
 	mfc80d.dll!CWnd::OnWndMsg(unsigned int message=15, unsigned int wParam=0, long lParam=0, long * pResult=0x00123d78)  Riga 2028	C++
 	mfc80d.dll!CWnd::WindowProc(unsigned int message=15, unsigned int wParam=0, long lParam=0)  Riga 1741	C++
 	mfc80d.dll!CControlBar::WindowProc(unsigned int nMsg=15, unsigned int wParam=0, long lParam=0)  Riga 504	C++
 	ProfUIS290md.dll!CExtStatusControlBar::WindowProc(unsigned int message=15, unsigned int wParam=0, long lParam=0)  Riga 1984	C++
 	mfc80d.dll!AfxCallWndProc(CWnd * pWnd=0x0725e470, HWND__ * hWnd=0x000106ca, unsigned int nMsg=15, unsigned int wParam=0, long lParam=0)  Riga 240	C++
 	mfc80d.dll!AfxWndProc(HWND__ * hWnd=0x000106ca, unsigned int nMsg=15, unsigned int wParam=0, long lParam=0)  Riga 389	C++
 	mfc80d.dll!AfxWndProcBase(HWND__ * hWnd=0x000106ca, unsigned int nMsg=15, unsigned int wParam=0, long lParam=0)  Riga 407	C++
 	user32.dll!7e398734() 	
 	user32.dll!7e398816() 	
 	user32.dll!7e3a8ea0() 	
 	user32.dll!7e3a8eec() 	
 	ntdll.dll!7c91e473() 	
 	user32.dll!7e3994d2() 	
 	user32.dll!7e3a8f10() 	
 	user32.dll!7e3a74b2() 	
 	user32.dll!7e398a10() 	
 	user32.dll!7e3a7721() 	
 	user32.dll!7e3a49c4() 	
 	user32.dll!7e3ba956() 	
 	msvcr80d.dll!_output_s_l(_iobuf * stream=0x000106b2, const char * format=0x001ee828, localeinfo_struct * plocinfo=0x001eb200, char * argptr=0x00012012)  Riga 1164	C++
 	user32.dll!7e3e64a2() 	
 	user32.dll!7e3d0877() 	
 	user32.dll!7e3d082f() 	
 	msvcr80d.dll!__crtMessageBoxA(const char * lpText=0x001247a0, const char * lpCaption=0x00891174, unsigned int uType=73746)  Riga 145	C
 	msvcr80d.dll!__crtMessageWindowA(int nRptType=2, const char * szFile=0x01a567d8, const char * szLine=0x00126814, const char * szModule=0x00000000, const char * szUserMessage=0x00125814)  Riga 420	C
 	msvcr80d.dll!_VCrtDbgReportA(int nRptType=2, const char * szFile=0x01a567d8, int nLine=28946, const char * szModule=0x00000000, const char * szFormat=0x00000000, char * arglist=0x0012a8a8)  Riga 417	C
 	msvcr80d.dll!_CrtDbgReportV(int nRptType=2, const char * szFile=0x01a567d8, int nLine=28946, const char * szModule=0x00000000, const char * szFormat=0x00000000, char * arglist=0x0012a8a8)  Riga 300	C
 	msvcr80d.dll!_CrtDbgReport(int nRptType=2, const char * szFile=0x01a567d8, int nLine=28946, const char * szModule=0x00000000, const char * szFormat=0x00000000, ...)  Riga 317	C
 	mfc80d.dll!AfxAssertFailedLine(const char * lpszFileName=0x01a567d8, int nLine=28946)  Riga 25	C++
 	ProfUIS290md.dll!CExtPaintManagerOffice2007_Impl::NcFrame_Paint(CDC & dc={...}, const CExtCmdIcon * pIcon=0x0012ab64, const char * strCaption=0x094c0648, unsigned int nDrawTextAlignFlags=36, const tagRECT & rcFrame={...}, const tagRECT & rcClient={...}, const tagRECT & rcIcon={...}, const tagRECT & rcText={...}, const tagRECT & rcHelp={...}, const tagRECT & rcMinimize={...}, const tagRECT & rcMaximizeRestore={...}, const tagRECT & rcClose={...}, bool bFrameActive=false, bool bFrameEnabled=false, bool bFrameMaximized=true, CExtPaintManager::e_nc_button_state_t eStateButtonHelp=__ENCBS_DISABLED, CExtPaintManager::e_nc_button_state_t eStateButtonMinimize=__ENCBS_NORMAL, CExtPaintManager::e_nc_button_state_t eStateButtonMaximizeRestore=__ENCBS_NORMAL, CExtPaintManager::e_nc_button_state_t eStateButtonClose=__ENCBS_NORMAL, const CWnd * pWnd=0x0725dad0, long lParam=0)  Riga 28946	C++
 	ProfUIS290md.dll!CExtNcFrameImpl::NcFrameImpl_OnNcPaint(CDC & dcPaint={...}, bool bOuterEmulationMode=false)  Riga 1992	C++
 	ProfUIS290md.dll!CExtNcFrameImpl::NcFrameImpl_PreWindowProc(long & lResult=0, unsigned int message=133, unsigned int wParam=0, long lParam=0)  Riga 2874	C++
 	[Codice esterno]	
 	DentalVox.exe!CExtNCW<CFrameWnd>::WindowProc(unsigned int message = 133, unsigned int wParam = 0, int lParam = 0) Riga 376	C++
 	[Codice esterno]	
 	mfc80d.dll!AfxCallWndProc(CWnd * pWnd=0x0725dad0, HWND__ * hWnd=0x000106b2, unsigned int nMsg=133, unsigned int wParam=0, long lParam=0)  Riga 240	C++
 	mfc80d.dll!AfxWndProc(HWND__ * hWnd=0x000106b2, unsigned int nMsg=133, unsigned int wParam=0, long lParam=0)  Riga 389	C++
 	mfc80d.dll!AfxWndProcBase(HWND__ * hWnd=0x000106b2, unsigned int nMsg=133, unsigned int wParam=0, long lParam=0)  Riga 407	C++
 	user32.dll!7e398734() 	
 	user32.dll!7e398816() 	
 	user32.dll!7e3aa013() 	
 	user32.dll!7e3aa998() 	
 	ProfUIS290md.dll!CExtHookSink::HookChains_t::HookChainsWindowProc(unsigned int nMessage=133, unsigned int & wParam=0, long & lParam=0)  Riga 227	C++
 	ProfUIS290md.dll!CExtHookSink::HookChains_t::g_HookWndProc(HWND__ * hWnd=0x000106b2, unsigned int nMessage=133, unsigned int wParam=0, long lParam=0)  Riga 291	C++
 	user32.dll!7e398734() 	
 	user32.dll!7e3abdf1() 	
 	user32.dll!7e3a8ea0() 	
 	user32.dll!7e3a8eec() 	
 	ntdll.dll!7c91e473() 	
 	user32.dll!7e3994be() 	
 	user32.dll!7e3ac174() 	
 	user32.dll!7e3af40b() 	
 	mfc80d.dll!CWnd::SendMessageA(unsigned int message=133, unsigned int wParam=0, long lParam=0)  Riga 42	C++
 	ProfUIS290md.dll!CExtNcFrameImpl::NcFrameImpl_PostWindowProc(long & lResult=0, unsigned int message=10, unsigned int wParam=0, long lParam=0)  Riga 4088	C++
 	DentalVox.exe!CExtNCW<CFrameWnd>::WindowProc(unsigned int message = 10, unsigned int wParam = 0, int lParam = 0) Riga 384	C++
 	[Codice esterno]	
 	mfc80d.dll!AfxCallWndProc(CWnd * pWnd=0x0725dad0, HWND__ * hWnd=0x000106b2, unsigned int nMsg=10, unsigned int wParam=0, long lParam=0)  Riga 240	C++
 	mfc80d.dll!AfxWndProc(HWND__ * hWnd=0x000106b2, unsigned int nMsg=10, unsigned int wParam=0, long lParam=0)  Riga 389	C++
 	mfc80d.dll!AfxWndProcBase(HWND__ * hWnd=0x000106b2, unsigned int nMsg=10, unsigned int wParam=0, long lParam=0)  Riga 407	C++
 	user32.dll!7e398734() 	
 	user32.dll!7e398816() 	
 	user32.dll!7e3aa013() 	
 	user32.dll!7e3aa998() 	
 	ProfUIS290md.dll!CExtHookSink::HookChains_t::HookChainsWindowProc(unsigned int nMessage=10, unsigned int & wParam=0, long & lParam=0)  Riga 227	C++
 	ProfUIS290md.dll!CExtHookSink::HookChains_t::g_HookWndProc(HWND__ * hWnd=0x000106b2, unsigned int nMessage=10, unsigned int wParam=0, long lParam=0)  Riga 291	C++
 	user32.dll!7e398734() 	
 	user32.dll!7e398816() 	
 	user32.dll!7e3a8ea0() 	
 	user32.dll!7e3a8eec() 	
 	ntdll.dll!7c91e473() 	
 	user32.dll!7e3a9841() 	
 	user32.dll!7e3a985b() 	
 	mfc80d.dll!CDialog::DoModal()  Riga 517	C++
 	ProfUIS290md.dll!CExtMsgBox::DoModal()  Riga 9099	C++
 	ProfUIS290md.dll!CExtMsgBox::DoMsgBox(HWND__ * hWndParent=0x000106b2, const char * strMessageText=0x0012d844, const char * strCaption=0x004c7378, unsigned int nMsgBoxStyle=16, unsigned int nHelpID=0, const char * strUniqueID=0x00000000, unsigned int nMsgBoxStyleEx=0, unsigned int nTimeoutSeconds=0, bool bIsDisabledTimeout=false, CExtBitmap * pBmpIcon=0x00000000)  Riga 9905	C++
 	ProfUIS290md.dll!ProfUISMsgBox(HWND__ * hWndParent=0x000106b2, const char * strMessageText=0x0012d844, const char * strCaption=0x004c7378, unsigned int nMsgBoxStyle=16, unsigned int nHelpID=0, const char * strUniqueID=0x00000000, unsigned int nMsgBoxStyleEx=0, unsigned int nTimeoutSeconds=0, bool bIsDisabledTimeout=false, CExtBitmap * pBmpIcon=0x00000000)  Riga 9955	C++
 	DentalVox.exe!CDentalVoxApp::DoMessageBox(char* lpszPrompt = 0x0012D844, unsigned int nType = 16, unsigned int nIDPrompt = 0) Riga 38	C++
 	[Codice esterno]	
 	mfc80d.dll!AfxMessageBox(const char * lpszText=0x0012d844, unsigned int nType=16, unsigned int nIDHelp=0)  Riga 148	C++
 	mfc80d.dll!CException::ReportError(unsigned int nType=16, unsigned int nError=61704)  Riga 113	C++
 	mfc80d.dll!CWinApp::ProcessWndProcException(CException * e=0x783eb2a8, const tagMSG * pMsg=0x0015cda4)  Riga 977	C++
 	mfc80d.dll!AfxProcessWndProcException(CException * e=0x783eb2a8, const tagMSG * pMsg=0x0015cda4)  Riga 214	C++
 	mfc80d.dll!AfxCallWndProc(CWnd * pWnd=0x072a0608, HWND__ * hWnd=0x000106b8, unsigned int nMsg=513, unsigned int wParam=1, long lParam=16974058)  Riga 248	C++
 	mfc80d.dll!AfxWndProc(HWND__ * hWnd=0x000106b8, unsigned int nMsg=513, unsigned int wParam=1, long lParam=16974058)  Riga 389	C++
 	mfc80d.dll!AfxWndProcBase(HWND__ * hWnd=0x000106b8, unsigned int nMsg=513, unsigned int wParam=1, long lParam=16974058)  Riga 407	C++
 	user32.dll!7e398734() 	
 	user32.dll!7e398816() 	
 	user32.dll!7e3aa013() 	
 	user32.dll!7e3aa039() 	
 	opengl32.dll!5f16699b() 	
 	mfc80d.dll!CThreadLocalObject::GetData(CNoTrackObject * (void)* pfnCreateObject=0x5f166780)  Riga 419	C++
 	user32.dll!7e398816() 	
 	user32.dll!7e3989cd() 	
 	user32.dll!7e3996c7() 	
 	mfc80d.dll!AfxInternalPumpMessage()  Riga 183	C++
 	mfc80d.dll!CWinThread::PumpMessage()  Riga 896	C++
 	mfc80d.dll!CWinThread::Run()  Riga 625	C++
 	mfc80d.dll!CWinApp::Run()  Riga 889	C++
 	mfc80d.dll!AfxWinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x00151f26, int nCmdShow=5)  Riga 47	C++
 	DentalVox.exe!WinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x00151f26, int nCmdShow=5)  Riga 29	C++
 	DentalVox.exe!__tmainCRTStartup()  Riga 578	C
 	DentalVox.exe!WinMainCRTStartup()  Riga 403	C
 	mfc80d.dll!AfxMessageBox(const char * lpszText=0x0012d844, unsigned int nType=16, unsigned int nIDHelp=0)  Riga 148	C++
 	mfc80d.dll!CException::ReportError(unsigned int nType=16, unsigned int nError=61704)  Riga 113	C++
 	mfc80d.dll!CWinApp::ProcessWndProcException(CException * e=0x783eb2a8, const tagMSG * pMsg=0x0015cda4)  Riga 977	C++
 	mfc80d.dll!AfxProcessWndProcException(CException * e=0x783eb2a8, const tagMSG * pMsg=0x0015cda4)  Riga 214	C++
 	mfc80d.dll!AfxCallWndProc(CWnd * pWnd=0x072a0608, HWND__ * hWnd=0x000106b8, unsigned int nMsg=513, unsigned int wParam=1, long lParam=16974058)  Riga 248	C++
 	mfc80d.dll!AfxWndProc(HWND__ * hWnd=0x000106b8, unsigned int nMsg=513, unsigned int wParam=1, long lParam=16974058)  Riga 389	C++
 	mfc80d.dll!AfxWndProcBase(HWND__ * hWnd=0x000106b8, unsigned int nMsg=513, unsigned int wParam=1, long lParam=16974058)  Riga 407	C++
 	user32.dll!7e398734() 	
 	user32.dll!7e398816() 	
 	user32.dll!7e3aa013() 	
 	user32.dll!7e3aa039() 	
 	opengl32.dll!5f16699b() 	
 	mfc80d.dll!CThreadLocalObject::GetData(CNoTrackObject * (void)* pfnCreateObject=0x5f166780)  Riga 419	C++
 	user32.dll!7e398816() 	
 	user32.dll!7e3989cd() 	
 	user32.dll!7e3996c7() 	
 	mfc80d.dll!AfxInternalPumpMessage()  Riga 183	C++
 	mfc80d.dll!CWinThread::PumpMessage()  Riga 896	C++
 	mfc80d.dll!CWinThread::Run()  Riga 625	C++
 	mfc80d.dll!CWinApp::Run()  Riga 889	C++
 	mfc80d.dll!AfxWinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x00151f26, int nCmdShow=5)  Riga 47	C++
 	DentalVox.exe!WinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x00151f26, int nCmdShow=5)  Riga 29	C++
 	DentalVox.exe!__tmainCRTStartup()  Riga 578	C
 	DentalVox.exe!WinMainCRTStartup()  Riga 403	C
 	ntdll.dll!7c937784() 	
 	ntdll.dll!7c937573() 	
 	ntdll.dll!7c92005d() 	
 	ntdll.dll!7c91dc1a() 	
 	ntdll.dll!7c92005d() 	
 	ntdll.dll!7c92005d() 	
 	ntdll.dll!7c937784() 	
 	ntdll.dll!7c937573() 	
 	ntdll.dll!7c92005d() 	
 	kernel32.dll!7c80262a() 	
 	kernel32.dll!7c802600() 	
 	ntdll.dll!7c9201db() 	
 	ntdll.dll!7c946f38() 	
 	mscoree.dll!7900b77b() 	
 	ntdll.dll!7c9201db() 	
 	mscoree.dll!7900b73d() 	
 	mscoree.dll!79004de3() 	
 	ntdll.dll!7c9201db() 	
 	kernel32.dll!7c817077() 	
 	ntdll.dll!7c946f38() 	
 	ntdll.dll!7c9201db() 	


Second occurrence involved code strips:
dbgrptt.c

_CRTIMP void _cdecl _CrtDbgBreak(
    void
    )
{
    DebugBreak();
=>}

ˆ
|

dbgrptt.c
// nRptType = 2
// szFile = 0x01a4bcf0 "..\Src\ExtCmdIcon.cpp"
// nLine = 4859
// szModule = 0x00000000 <Ptr>
// szFormat = 0x00000000 <Ptr>

_CRTIMP int __cdecl _VCrtDbgReportA
(
    int nRptType,
    const char * szFile,
    int nLine,
    const char * szModule,
    const char * szFormat,
    va_list arglist
    )
{
    int retval=0;
    int handled=FALSE;
    char szLineMessage[DBGRPT_MAX_MSG] = {0};
    char szOutMessage[DBGRPT_MAX_MSG] = {0};
    wchar_t szOutMessage2[DBGRPT_MAX_MSG] = {0};
    char szUserMessage[DBGRPT_MAX_MSG] = {0};

    if (nRptType < 0 || nRptType >= _CRT_ERRCNT)
        return -1;

    /*
     * handle the (hopefully rare) case of
     *
     * 1) ASSERT while already dealing with an ASSERT
     *  If it’s a recursive assert, the mlock(_DEBUG_LOCK) will not
     *  block(because we are in the same thread) & _crtAssertBusy value will
     *  cause DebugBreak to be called.
     *      or
     * 2) two threads asserting at the same time - here
     *  mlock(_DEBUG_LOCK) will cause the asserts to be serialized
     */

    _mlock(_DEBUG_LOCK);
    __try
    {

        if (_CRT_ASSERT == nRptType && _CrtInterlockedIncrement(&_crtAssertBusy) > 0)
        {
            /* use only ’safe’ functions -- must not assert in here! */

            _ERRCHECK(_itoa_s(nLine, szLineMessage, DBGRPT_MAX_MSG, 10));

            OutputDebugStringA("Second Chance Assertion Failed: File ");
            OutputDebugStringA(szFile ? szFile : "<file unknown>");
            OutputDebugStringA(", Line ");
            OutputDebugStringA(szLineMessage);
            OutputDebugStringA("\n");

            _CrtDbgBreak();
=>          retval=-1;
        }

ˆ
|

dbgrpt.c
// __inline int __cdecl _CrtDbgReportTV(...)
// Row 300

#endif  /* _UNICODE */

=>  return _VCrtDbgReportT(nRptType,szFile,nLine,szModule,szFormat,arglist);
}

ˆ
|

dbgrpt.c

_CRTIMP int __cdecl _CrtDbgReportT(
        int nRptType,
        const TCHAR * szFile,
        int nLine,
        const TCHAR * szModule,
        const TCHAR * szFormat,
        ...
        )
{
    int retval;
    va_list arglist;

    va_start(arglist,szFormat);

=>  retval = _CrtDbgReportTV(nRptType, szFile, nLine, szModule, szFormat, arglist);

    va_end(arglist);

    return retval;
}

ˆ
|

afxasert.cpp

BOOL AFXAPI AfxAssertFailedLine(LPCSTR lpszFileName, int nLine)
{
#ifndef _AFX_NO_DEBUG_CRT
	// we remove WM_QUIT because if it is in the queue then the message box
	// won’t display
	MSG msg;
	BOOL bQuit = PeekMessage(&msg, NULL, WM_QUIT, WM_QUIT, PM_REMOVE);
=>	BOOL bResult = _CrtDbgReport(_CRT_ASSERT, lpszFileName, nLine, NULL, NULL);
	if (bQuit)
		PostQuitMessage((int)msg.wParam);
	return bResult;
#else
	// Not supported.
#error _AFX_NO_DEBUG_CRT is not supported.
#endif // _AFX_NO_DEBUG_CRT
}

ˆ
|

extcmdicon.cpp
// hDC = 0x00000000 {unused=??? }
// rcDstDraw = {top=0 bottom=18 left=0 right=1280}
// rcPadding = {top=1 bottom=1 left=0 right=0}
// eDM = __EDM_STRETCH
// bDrawMiddlePart = true
// bSmootherAsPossible = false
// dwRop = 13369376

bool CExtBitmap::DrawSkinParts(
	HDC hDC,
	const RECT & rcDstDraw,
	const RECT & rcPadding,
	e_DrawMethod_t eDM,
	bool bDrawMiddlePart, // = true
	bool bSmootherAsPossible, // = false
	DWORD dwRop // = SRCCOPY
	) const
{
=>	ASSERT( hDC != NULL );
	ASSERT( rcPadding.left >= 0 );
	ASSERT( rcPadding.right >= 0 );
	ASSERT( rcPadding.top >= 0 );
	ASSERT( rcPadding.bottom >= 0 );

ˆ
|

extpaintmanager.cpp
// bool CExtPaintManagerOffice2007_Impl::StatusBar_EraseBackground(...)
// Row 28383
// dc.m_hDC = 0x00000000 {unused=??? }
// rcClient = {top=0 bottom=18 left=0 right=1280}
// m_rcStatusBkPadding = {top=1 bottom=1 left=0 right=0}
// CExtBitmap::__EDM_STRETCH = 2

	if( bLastIsDark )
		m_bmpStatusBkDark.DrawSkinParts(
			dc.m_hDC,
			rcClient,
			m_rcStatusBkPadding,
			CExtBitmap::__EDM_STRETCH
			);
	else
		m_bmpStatusBkLight.DrawSkinParts(
			dc.m_hDC,
			rcClient,
			m_rcStatusBkPadding,
			CExtBitmap::__EDM_STRETCH
			);
=>	for( nPaneIdx = 0; nPaneIdx < nPaneCount; nPaneIdx++ )
	{
		CExtStatusControlBar::e_StatusPaneBackgroundAccent_t eSPBA =
			pStatusBar->OnQueryPaneBackgroundAccent( nPaneIdx );

ˆ
|

extstatuscontrolbar.cpp

void CExtStatusControlBar::OnPaintEntireBackground(
	CDC & dc,
	const CRect & rcBk
	)
{
	ASSERT_VALID( this );
	if(		m_bCompleteRepaint
		&&	PmBridge_GetPM()->StatusBar_EraseBackground(
			dc,
			rcBk,
			this
			)
=>		)

ˆ
|

extstatuscontrolbar.cpp

void CExtStatusControlBar::DoPaint( CDC * pDC )
{
	ASSERT_VALID( this );
	ASSERT_VALID( pDC );

	// XP painting & last pane size fixed by Dmitry Yakovlev
	_SyncStatusBarColors();

CRect rcClient;
	GetClientRect( &rcClient );
	CExtPaintManager::stat_ExcludeChildAreas(
		*pDC,
		GetSafeHwnd(),
		CExtPaintManager::stat_DefExcludeChildAreaCallback
		);
CExtMemoryDC dc(
		pDC,
		&rcClient
		);
	UpdateAllPanes( FALSE, TRUE );
	
	// erase client area with the current color/gradient
CRect rcFill( rcClient );
	rcFill.left = rcFill.top = 0;
	rcFill.right  -= rcClient.left;
	rcFill.bottom -= rcClient.top;
=>	OnPaintEntireBackground( dc, rcFill );

ˆ
|

extstatuscontrolbar.cpp

void CExtStatusControlBar::OnPaint() 
{
	ASSERT_VALID( this );
	
	if( m_bLockPainting ) 
		return;

	if( !m_bCompleteRepaint )
	{
		Default();
		return;
	}

	CPaintDC dcPaint( this );
=>	DoPaint( &dcPaint );
}

ˆ
|

wincore.cpp
// BOOL CWnd::OnWndMsg(...)
// Row 2028

	case AfxSig_v_v_v:
		(this->*mmf.pfn_v_v)();
=>		break;

ˆ
|

wincore.cpp

LRESULT CWnd::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
	// OnWndMsg does most of the work, except for DefWindowProc call
	LRESULT lResult = 0;
=>	if (!OnWndMsg(message, wParam, lParam, &lResult))
		lResult = DefWindowProc(message, wParam, lParam);
	return lResult;
}

ˆ
|

barcore.cpp
// LRESULT CControlBar::WindowProc(...)
// Row 504

	// otherwise, just handle in default way
=>	lResult = CWnd::WindowProc(nMsg, wParam, lParam);
	return lResult;
}

ˆ
|

extstatuscontrolbar.cpp
// LRESULT CExtStatusControlBar::WindowProc(...)
// Row 1984

		if( (lParam&PRF_CHILDREN) != 0 )
			CExtPaintManager::stat_PrintChildren(
				m_hWnd,
				message,
				pDC->GetSafeHdc(),
				lParam,
				false
				);
		return (!0);
	}
	return CStatusBar::WindowProc(message, wParam, lParam);
=>}

ˆ
|

wincore.cpp

LRESULT AFXAPI AfxCallWndProc(CWnd* pWnd, HWND hWnd, UINT nMsg,
	WPARAM wParam = 0, LPARAM lParam = 0)
{
	_AFX_THREAD_STATE* pThreadState = _afxThreadState.GetData();
	MSG oldState = pThreadState->m_lastSentMsg;   // save for nesting
	pThreadState->m_lastSentMsg.hwnd = hWnd;
	pThreadState->m_lastSentMsg.message = nMsg;
	pThreadState->m_lastSentMsg.wParam = wParam;
	pThreadState->m_lastSentMsg.lParam = lParam;

#ifdef _DEBUG
	_AfxTraceMsg(_T("WndProc"), &pThreadState->m_lastSentMsg);
#endif

	// Catch exceptions thrown outside the scope of a callback
	// in debug builds and warn the user.
	LRESULT lResult;
	TRY
	{
#ifndef _AFX_NO_OCC_SUPPORT
		// special case for WM_DESTROY
		if ((nMsg == WM_DESTROY) && (pWnd->m_pCtrlCont != NULL))
			pWnd->m_pCtrlCont->OnUIActivate(NULL);				
#endif

		// special case for WM_INITDIALOG
		CRect rectOld;
		DWORD dwStyle = 0;
		if (nMsg == WM_INITDIALOG)
			_AfxPreInitDialog(pWnd, &rectOld, &dwStyle);

		// delegate to object’s WindowProc
=>		lResult = pWnd->WindowProc(nMsg, wParam, lParam);

ˆ
|

wincore.cpp

LRESULT CALLBACK
AfxWndProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam)
{
	// special message which identifies the window as using AfxWndProc
	if (nMsg == WM_QUERYAFXWNDPROC)
		return 1;

	// all other messages route through message map
	CWnd* pWnd = CWnd::FromHandlePermanent(hWnd);
	ASSERT(pWnd != NULL);					
	ASSERT(pWnd==NULL || pWnd->m_hWnd == hWnd);
	if (pWnd == NULL || pWnd->m_hWnd != hWnd)
		return ::DefWindowProc(hWnd, nMsg, wParam, lParam);
	return AfxCallWndProc(pWnd, hWnd, nMsg, wParam, lParam);
=>}

ˆ
|

afxstate.cpp

LRESULT CALLBACK
AfxWndProcBase(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam)
{
	AFX_MANAGE_STATE(_afxBaseModuleState.GetData());
=>	return AfxWndProc(hWnd, nMsg, wParam, lParam);
}

ˆ
|

output.c
// Row 1164

=>          WRITE_CHAR(ch, &charsout);
            break;

        case ST_PERCENT:
            /* set default value of conversion parameters */
            prefixlen = fldwidth = no_output = capexp = 0;
            flags = 0;
            precision = -1;
            bufferiswide = 0;   /* default */
            break;

ˆ
|

crtmbox.c
// #ifdef _UNICODE
// int __cdecl __crtMessageBoxW(
// #else  /* _UNICODE */
// int __cdecl __crtMessageBoxA(
// Row 145

        if (fNonInteractive)
        {
            _ERRCHECK(_get_winmajor(&winmajor));
            if (winmajor >= 4)
                uType |= MB_SERVICE_NOTIFICATION;
            else
                uType |= MB_SERVICE_NOTIFICATION_NT3X;
        }
        else
        {
            if (pfnGetActiveWindow != enull)
                hWndParent = ((PFNGetActiveWindow) _decode_pointer(pfnGetActiveWindow))();

            if (hWndParent != NULL && pfnGetLastActivePopup != enull)
                hWndParent = ((PFNGetLastActivePopup) _decode_pointer(pfnGetLastActivePopup))(hWndParent);
        }

        return ((PFNMessageBox) _decode_pointer(pfnMessageBox))(hWndParent, lpText, lpCaption, uType);
=>}

ˆ
|

dbgrpt.c
// int __cdecl __crtMessageWindow(...)
// Row 420

#ifdef _UNICODE
            _ERRCHECK(wcscpy_s(szOutMessage, DBGRPT_MAX_MSG, _CRT_WIDE(DBGRPT_TOOLONGMSG)));
#else  /* _UNICODE */
            _ERRCHECK(strcpy_s(szOutMessage, DBGRPT_MAX_MSG, DBGRPT_TOOLONGMSG));
#endif  /* _UNICODE */

        /* Report the warning/error */
        nCode = __crtMessageBox(szOutMessage,
                             _T("Microsoft Visual C++ Debug Library"),
=>                           MB_TASKMODAL|MB_ICONHAND|MB_ABORTRETRYIGNORE|MB_SETFOREGROUND);

ˆ
|

dbgrptt.c
// _CRTIMP int __cdecl _VCrtDbgReportA(...)
// Row 417

                    if (_CrtDbgMode[nRptType] & _CRTDBG_MODE_WNDW)
                    {
                        szLineMessage[0] = 0;
                        if (nLine)
                        {
                            _ERRCHECK(_itoa_s(nLine, szLineMessage, DBGRPT_MAX_MSG, 10));
                        }
=>                      retval = __crtMessageWindowA(nRptType, szFile, (nLine ? szLineMessage : NULL), szModule, szUserMessage);
                    }
                }
            }
        }
    }

ˆ
|

dbgrpt.c
// __inline int __cdecl _CrtDbgReportTV(...)
// Row 300

#endif  /* _UNICODE */

=>    return _VCrtDbgReportT(nRptType,szFile,nLine,szModule,szFormat,arglist);
}

ˆ
|

dbgrpt.c

_CRTIMP int __cdecl _CrtDbgReportT(
        int nRptType,
        const TCHAR * szFile,
        int nLine,
        const TCHAR * szModule,
        const TCHAR * szFormat,
        ...
        )
{
    int retval;
    va_list arglist;

    va_start(arglist,szFormat);

=>  retval = _CrtDbgReportTV(nRptType, szFile, nLine, szModule, szFormat, arglist);

    va_end(arglist);

    return retval;
}

ˆ
|

afxasert.cpp

BOOL AFXAPI AfxAssertFailedLine(LPCSTR lpszFileName, int nLine)
{
#ifndef _AFX_NO_DEBUG_CRT
	// we remove WM_QUIT because if it is in the queue then the message box
	// won’t display
	MSG msg;
	BOOL bQuit = PeekMessage(&msg, NULL, WM_QUIT, WM_QUIT, PM_REMOVE);
=>	BOOL bResult = _CrtDbgReport(_CRT_ASSERT, lpszFileName, nLine, NULL, NULL);
	if (bQuit)
		PostQuitMessage((int)msg.wParam);
	return bResult;
#else
	// Not supported.
#error _AFX_NO_DEBUG_CRT is not supported.
#endif // _AFX_NO_DEBUG_CRT
}

ˆ
|

extpaintmanager.cpp

void CExtPaintManagerOffice2007_Impl::NcFrame_Paint(
	CDC & dc,
	const CExtCmdIcon * pIcon,
	__EXT_MFC_SAFE_LPCTSTR strCaption,
	UINT nDrawTextAlignFlags,
	const RECT & rcFrame,
	const RECT & rcClient,
	const RECT & rcIcon,
	const RECT & rcText,
	const RECT & rcHelp,
	const RECT & rcMinimize,
	const RECT & rcMaximizeRestore,
	const RECT & rcClose,
	bool bFrameActive,
	bool bFrameEnabled,
	bool bFrameMaximized,
	CExtPaintManager::e_nc_button_state_t eStateButtonHelp,
	CExtPaintManager::e_nc_button_state_t eStateButtonMinimize,
	CExtPaintManager::e_nc_button_state_t eStateButtonMaximizeRestore,
	CExtPaintManager::e_nc_button_state_t eStateButtonClose,
	const CWnd * pWnd,
	LPARAM lParam // = 0L
	) const
{
	ASSERT_VALID( this );
=>	ASSERT( dc.GetSafeHdc() != NULL );

ˆ
|

extncframe.cpp
// void CExtNcFrameImpl::NcFrameImpl_OnNcPaint(...)
// Row 1992

		pPM->NcFrame_Paint(
			dc,
			bDrawIcon ? (&_icon) : NULL,
			bDrawCaptionText ? LPCTSTR(strCaption) : _T(""),
			nDtFlags,
			rcWnd,
			rcClient,
			rcDrawIcon,
			rcDrawText,
			m_rcNcFrameImpl_ScHelp,
			m_rcNcFrameImpl_ScMinimize,
			m_rcNcFrameImpl_ScMaximize,
			m_rcNcFrameImpl_ScClose,
			bFrameActive,
			bFrameEnabled,
			bFrameMaximized,
			eStateButtonHelp,
			eStateButtonMinimize,
			eStateButtonMaximizeRestore,
			eStateButtonClose,
			pWndFrameImpl
=>			);

ˆ
|

extncframe.cpp
// bool CExtNcFrameImpl::NcFrameImpl_PreWindowProc(...)
// Row 2874

	case WM_NCPAINT:
		if( ! NcFrameImpl_IsDwmBased() )
		{
			if(		(! NcFrameImpl_IsForceEmpty() )
//				||	m_bNcFrameImpl_RestoreEnabledState
				)
			{
				CMDIChildWnd * pWndMdiChild = DYNAMIC_DOWNCAST( CMDIChildWnd, pWndFrameImpl );
				if( pWndMdiChild != NULL && pWndMdiChild->IsWindowEnabled() )
				{
					HWND hWndMDIClient = ::GetParent( pWndMdiChild->m_hWnd );
					HWND hWndActiveChildFrame = (HWND) ::SendMessage( hWndMDIClient, WM_MDIGETACTIVE, 0, NULL );
					if( hWndActiveChildFrame != NULL )
						m_bNcFrameImpl_IsActive = ( hWndActiveChildFrame == pWndMdiChild->m_hWnd ) ? true : false;
				}
				CWindowDC dcPaint( pWndFrameImpl );
=>				NcFrameImpl_OnNcPaint( dcPaint );
				lResult = 0;
				return true;
			}
		} //if( ! NcFrameImpl_IsDwmBased() )
		break;

ˆ
|

extncframe.h

	virtual LRESULT WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
	{
		HWND hWndOwn = m_hWnd;
		LRESULT lResult = 0;
		if( NcFrameImpl_FilterWindowProc( lResult, message, wParam, lParam ) )
			return lResult;
		if( ! ::IsWindow( hWndOwn ) )
			return lResult;
		if( ! NcFrameImpl_IsSupported() )
			return _BTNCW::WindowProc( message, wParam, lParam );
=>		if( NcFrameImpl_PreWindowProc( lResult, message, wParam, lParam ) )
			return lResult;
		lResult = _BTNCW::WindowProc( message, wParam, lParam );
		if( ! ::IsWindow( hWndOwn ) )
			return lResult;
		if( CWnd::FromHandlePermanent(hWndOwn) == NULL )
			return lResult;
		NcFrameImpl_PostWindowProc( lResult, message, wParam, lParam );
		return lResult;
	}

ˆ
|

wincore.cpp

LRESULT AFXAPI AfxCallWndProc(CWnd* pWnd, HWND hWnd, UINT nMsg,
	WPARAM wParam = 0, LPARAM lParam = 0)
{
	_AFX_THREAD_STATE* pThreadState = _afxThreadState.GetData();
	MSG oldState = pThreadState->m_lastSentMsg;   // save for nesting
	pThreadState->m_lastSentMsg.hwnd = hWnd;
	pThreadState->m_lastSentMsg.message = nMsg;
	pThreadState->m_lastSentMsg.wParam = wParam;
	pThreadState->m_lastSentMsg.lParam = lParam;

#ifdef _DEBUG
	_AfxTraceMsg(_T("WndProc"), &pThreadState->m_lastSentMsg);
#endif

	// Catch exceptions thrown outside the scope of a callback
	// in debug builds and warn the user.
	LRESULT lResult;
	TRY
	{
#ifndef _AFX_NO_OCC_SUPPORT
		// special case for WM_DESTROY
		if ((nMsg == WM_DESTROY) && (pWnd->m_pCtrlCont != NULL))
			pWnd->m_pCtrlCont->OnUIActivate(NULL);				
#endif

		// special case for WM_INITDIALOG
		CRect rectOld;
		DWORD dwStyle = 0;
		if (nMsg == WM_INITDIALOG)
			_AfxPreInitDialog(pWnd, &rectOld, &dwStyle);

		// delegate to object’s WindowProc
=>		lResult = pWnd->WindowProc(nMsg, wParam, lParam);

ˆ
|

wincore.cpp

LRESULT CALLBACK
AfxWndProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam)
{
	// special message which identifies the window as using AfxWndProc
	if (nMsg == WM_QUERYAFXWNDPROC)
		return 1;

	// all other messages route through message map
	CWnd* pWnd = CWnd::FromHandlePermanent(hWnd);
	ASSERT(pWnd != NULL);					
	ASSERT(pWnd==NULL || pWnd->m_hWnd == hWnd);
	if (pWnd == NULL || pWnd->m_hWnd != hWnd)
		return ::DefWindowProc(hWnd, nMsg, wParam, lParam);
	return AfxCallWndProc(pWnd, hWnd, nMsg, wParam, lParam);
=>}

ˆ
|

afxstate.cpp

LRESULT CALLBACK
AfxWndProcBase(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam)
{
	AFX_MANAGE_STATE(_afxBaseModuleState.GetData());
=>	return AfxWndProc(hWnd, nMsg, wParam, lParam);
}

ˆ
|

exthook.cpp
// struct __PROF_UIS_API CExtHookSink::HookChains_t
// LRESULT HookChainsWindowProc(...)
// Row 227

		if( nMessage == WM_NCDESTROY ) 
		{
			DestroyChains( true );
//			if( pWndPermanent != NULL )
//			{
//				__PROF_UIS_MANAGE_STATE;
//				CWnd * pWndExamine =
//					CWnd::FromHandlePermanent( hWndHooked );
//				if( pWndExamine != pWndPermanent )
//					return 0L;
//			} // if( pWndPermanent != NULL )
			if( bEatNcDestroy )
				return 0L;
		} // if( nMessage == WM_NCDESTROY ) 
		LRESULT lResult =
			::CallWindowProc(
				pWNDPROC,
				hWndHooked,
				nMessage,
				wParam,
				lParam
=>				);

ˆ
|

exthook.cpp

CExtHookSink::HookChains_t * pHookChains = NULL;
	if( g_HookChainsMap.Lookup( hWnd, pHookChains ) )
	{
		ASSERT( pHookChains != NULL );
		ASSERT( pHookChains->m_hWndHooked == hWnd );
		lResult =
			pHookChains->HookChainsWindowProc(
				nMessage,
				wParam,
				lParam
=>				);  
		if( nMessage == WM_NCDESTROY || ( ! ::IsWindow( hWnd ) ) ) 
			g_HookChainsMap.RemoveKey( hWnd );
	} // if( g_HookChainsMap.Lookup( hWnd, pHookChains ) )

	refMsgMfcCurr = msgMfcSaved;
	
	return lResult;
}

ˆ
|

afxwin2.inl

_AFXWIN_INLINE LRESULT CWnd::_AFX_FUNCNAME(SendMessage)(UINT message, WPARAM wParam, LPARAM lParam)
=>	{ ASSERT(::IsWindow(m_hWnd)); return ::SendMessage(m_hWnd, message, wParam, lParam); }
#pragma push_macro("SendMessage")
#undef SendMessage

ˆ
|

extncframe.cpp

void CExtNcFrameImpl::NcFrameImpl_PostWindowProc( LRESULT & lResult, UINT message, WPARAM wParam, LPARAM lParam )
{
	lResult;
	switch( message )
	{
	case WM_ENABLE:
		if( m_bNcFrameImpl_IsActive && wParam == 0 )
		{
			m_bNcFrameImpl_IsActive = false;
			if(		NcFrameImpl_IsSupported()
				&&	( ! NcFrameImpl_IsDwmBased() )
				)
			{
				CWnd * pWndFrameImpl = (CWnd *)NcFrameImpl_GetFrameWindow();
				pWndFrameImpl->SendMessage( WM_NCPAINT );
			}
		}
=>	break;
	case WM_CAPTURECHANGED:
		{
			if( ! NcFrameImpl_IsSupported() )
				break;
			if( NcFrameImpl_IsDwmBased() )
				break;
 			CWnd * pWndFrameImpl = (CWnd *)NcFrameImpl_GetFrameWindow();
			if( ((HWND)lParam) != pWndFrameImpl->m_hWnd )
				pWndFrameImpl->ModifyStyle( 0, WS_CAPTION|WS_BORDER, 0 );
		}
	break;

ˆ
|

extncframe.h

	virtual LRESULT WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
	{
		HWND hWndOwn = m_hWnd;
		LRESULT lResult = 0;
		if( NcFrameImpl_FilterWindowProc( lResult, message, wParam, lParam ) )
			return lResult;
		if( ! ::IsWindow( hWndOwn ) )
			return lResult;
		if( ! NcFrameImpl_IsSupported() )
			return _BTNCW::WindowProc( message, wParam, lParam );
		if( NcFrameImpl_PreWindowProc( lResult, message, wParam, lParam ) )
			return lResult;
		lResult = _BTNCW::WindowProc( message, wParam, lParam );
		if( ! ::IsWindow( hWndOwn ) )
			return lResult;
		if( CWnd::FromHandlePermanent(hWndOwn) == NULL )
			return lResult;
		NcFrameImpl_PostWindowProc( lResult, message, wParam, lParam );
=>		return lResult;
	}

ˆ
|

wincore.cpp

LRESULT AFXAPI AfxCallWndProc(CWnd* pWnd, HWND hWnd, UINT nMsg,
	WPARAM wParam = 0, LPARAM lParam = 0)
{
	_AFX_THREAD_STATE* pThreadState = _afxThreadState.GetData();
	MSG oldState = pThreadState->m_lastSentMsg;   // save for nesting
	pThreadState->m_lastSentMsg.hwnd = hWnd;
	pThreadState->m_lastSentMsg.message = nMsg;
	pThreadState->m_lastSentMsg.wParam = wParam;
	pThreadState->m_lastSentMsg.lParam = lParam;

#ifdef _DEBUG
	_AfxTraceMsg(_T("WndProc"), &pThreadState->m_lastSentMsg);
#endif

	// Catch exceptions thrown outside the scope of a callback
	// in debug builds and warn the user.
	LRESULT lResult;
	TRY
	{
#ifndef _AFX_NO_OCC_SUPPORT
		// special case for WM_DESTROY
		if ((nMsg == WM_DESTROY) && (pWnd->m_pCtrlCont != NULL))
			pWnd->m_pCtrlCont->OnUIActivate(NULL);				
#endif

		// special case for WM_INITDIALOG
		CRect rectOld;
		DWORD dwStyle = 0;
		if (nMsg == WM_INITDIALOG)
			_AfxPreInitDialog(pWnd, &rectOld, &dwStyle);

		// delegate to object’s WindowProc
=>		lResult = pWnd->WindowProc(nMsg, wParam, lParam);

ˆ
|

wincore.cpp

LRESULT CALLBACK
AfxWndProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam)
{
	// special message which identifies the window as using AfxWndProc
	if (nMsg == WM_QUERYAFXWNDPROC)
		return 1;

	// all other messages route through message map
	CWnd* pWnd = CWnd::FromHandlePermanent(hWnd);
	ASSERT(pWnd != NULL);					
	ASSERT(pWnd==NULL || pWnd->m_hWnd == hWnd);
	if (pWnd == NULL || pWnd->m_hWnd != hWnd)
		return ::DefWindowProc(hWnd, nMsg, wParam, lParam);
	return AfxCallWndProc(pWnd, hWnd, nMsg, wParam, lParam);
=>}

ˆ
|

afxstate.cpp

LRESULT CALLBACK
AfxWndProcBase(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam)
{
	AFX_MANAGE_STATE(_afxBaseModuleState.GetData());
=>	return AfxWndProc(hWnd, nMsg, wParam, lParam);
}

ˆ
|

exthook.cpp
// struct __PROF_UIS_API CExtHookSink::HookChains_t
// LRESULT HookChainsWindowProc(...)
// Row 227

		if( nMessage == WM_NCDESTROY ) 
		{
			DestroyChains( true );
//			if( pWndPermanent != NULL )
//			{
//				__PROF_UIS_MANAGE_STATE;
//				CWnd * pWndExamine =
//					CWnd::FromHandlePermanent( hWndHooked );
//				if( pWndExamine != pWndPermanent )
//					return 0L;
//			} // if( pWndPermanent != NULL )
			if( bEatNcDestroy )
				return 0L;
		} // if( nMessage == WM_NCDESTROY ) 
		LRESULT lResult =
			::CallWindowProc(
				pWNDPROC,
				hWndHooked,
				nMessage,
				wParam,
				lParam
=>				);

ˆ
|

exthook.cpp

LRESULT CALLBACK CExtHookSink::HookChains_t::g_HookWndProc(
	HWND hWnd,
	UINT nMessage,
	WPARAM wParam,
	LPARAM lParam
	)
{

LRESULT lResult = 0;

MSG & refMsgMfcCurr = AfxGetThreadState()->m_lastSentMsg;
MSG msgMfcSaved( refMsgMfcCurr );
	refMsgMfcCurr.hwnd    = hWnd;
	refMsgMfcCurr.message = nMessage;
	refMsgMfcCurr.wParam  = wParam;
	refMsgMfcCurr.lParam  = lParam;

CExtHookSink::HookChains_t * pHookChains = NULL;
	if( g_HookChainsMap.Lookup( hWnd, pHookChains ) )
	{
		ASSERT( pHookChains != NULL );
		ASSERT( pHookChains->m_hWndHooked == hWnd );
		lResult =
			pHookChains->HookChainsWindowProc(
				nMessage,
				wParam,
				lParam
=>				);  
		if( nMessage == WM_NCDESTROY || ( ! ::IsWindow( hWnd ) ) ) 
			g_HookChainsMap.RemoveKey( hWnd );
	} // if( g_HookChainsMap.Lookup( hWnd, pHookChains ) )

	refMsgMfcCurr = msgMfcSaved;
	
	return lResult;
}

ˆ
|

dlgcore.cpp
// INT_PTR CDialog::DoModal()
// Row 517

#ifndef _AFX_NO_OLE_SUPPORT
	CWnd* pMainWnd = NULL;
	BOOL bEnableMainWnd = FALSE;
#endif
	if (hWndParent && hWndParent != ::GetDesktopWindow() && ::IsWindowEnabled(hWndParent))
	{
		::EnableWindow(hWndParent, FALSE);
=>		bEnableParent = TRUE;
#ifndef _AFX_NO_OLE_SUPPORT
		pMainWnd = AfxGetMainWnd();
		if (pMainWnd && pMainWnd->IsFrameWnd() && pMainWnd->IsWindowEnabled())
		{
			//
			// We are hosted by non-MFC container
			// 
			pMainWnd->EnableWindow(FALSE);
			bEnableMainWnd = TRUE;
		}
#endif

ˆ
|

extcontrolscommon.cpp
// __EXT_MFC_INT_PTR CExtMsgBox::DoModal()
// Row 9099

#if (defined _DEBUG)
	#if (_MFC_VER < 0x700)
		CWinThread * pWT = ::AfxGetThread();
		int nSavedWTDisablePumpCount = pWT->m_nDisablePumpCount;
		pWT->m_nDisablePumpCount = 0;
	#else
		_AFX_THREAD_STATE * pATH = ::AfxGetThreadState();
		int nSavedWTDisablePumpCount = pATH->m_nDisablePumpCount;
		pATH->m_nDisablePumpCount = 0;
	#endif
#endif
=>		nRetVal = CDialog::DoModal();
#if (defined _DEBUG)
	#if (_MFC_VER < 0x700)
		pWT->m_nDisablePumpCount = nSavedWTDisablePumpCount;
	#else
		pATH->m_nDisablePumpCount = nSavedWTDisablePumpCount;
	#endif
#endif

ˆ
|

extcontrolscommon.cpp

int CExtMsgBox::DoMsgBox(
	HWND hWndParent,
	__EXT_MFC_SAFE_LPCTSTR strMessageText,
	__EXT_MFC_SAFE_LPCTSTR strCaption, // = NULL
	UINT nMsgBoxStyle, // = __EXT_MB_DEFAULT_STYLES
	UINT nHelpID, // = 0
	__EXT_MFC_SAFE_LPCTSTR strUniqueID, // = NULL // for __EXT_MB_DO_NOT_DISPLAY_AGAIN and __EXT_MB_DO_NOT_ASK_AGAIN
	UINT nMsgBoxStyleEx, // = __EXT_MB_EX_DEFAULT_STYLES
	UINT nTimeoutSeconds, // = 0
	bool bIsDisabledTimeout, // = false
	CExtBitmap * pBmpIcon // = NULL
	)
{
__PROF_UIS_MANAGE_STATE;
	if( ::GetCapture() != NULL )
		::ReleaseCapture(); // force release mouse capture
	CExtMsgBox dlg( hWndParent, strMessageText, strCaption, nMsgBoxStyle, nHelpID, strUniqueID, nMsgBoxStyleEx );
	if( nTimeoutSeconds > 0 )
		dlg.TimeoutSet( nTimeoutSeconds, bIsDisabledTimeout );
	if( pBmpIcon != NULL && ( ! pBmpIcon->IsEmpty() ) )
		dlg.m_bmpIcon = (*pBmpIcon);
//HWND hWndFocusRestore = ::GetFocus();
=>	int nRetVal = int( dlg.DoModal() );
//	if(		hWndFocusRestore != NULL
//		&&	::IsWindow( hWndFocusRestore )
//		&&	::IsWindowEnabled( hWndFocusRestore )
//		&&	( ( ::__EXT_MFC_GetWindowLong( hWndFocusRestore, GWL_STYLE ) ) & WS_VISIBLE ) != 0
//		&&	::GetFocus() != hWndFocusRestore
//		)
//	{
//		CExtPopupMenuWnd::PassMsgLoop( false );
//		if(		::IsWindow( hWndFocusRestore )
//			&&	::IsWindowEnabled( hWndFocusRestore )
//			&&	( ( ::__EXT_MFC_GetWindowLong( hWndFocusRestore, GWL_STYLE ) ) & WS_VISIBLE ) != 0
//			&&	::GetFocus() != hWndFocusRestore
//			)
//			::SetFocus( hWndFocusRestore );
//	}
	return nRetVal;
}

ˆ
|

extcontrolscommon.cpp

int ProfUISMsgBox(
	HWND hWndParent,
	__EXT_MFC_SAFE_LPCTSTR strMessageText,
	__EXT_MFC_SAFE_LPCTSTR strCaption, // = NULL
	UINT nMsgBoxStyle, // = __EXT_MB_DEFAULT_STYLES
	UINT nHelpID, // = 0
	__EXT_MFC_SAFE_LPCTSTR strUniqueID, // = NULL // for __EXT_MB_DO_NOT_DISPLAY_AGAIN and __EXT_MB_DO_NOT_ASK_AGAIN
	UINT nMsgBoxStyleEx, // = __EXT_MB_EX_DEFAULT_STYLES
	UINT nTimeoutSeconds, // = 0
	bool bIsDisabledTimeout, // = false
	CExtBitmap * pBmpIcon // = NULL
	)
{
__PROF_UIS_MANAGE_STATE;
=>	return CExtMsgBox::DoMsgBox( hWndParent, strMessageText, strCaption, nMsgBoxStyle, nHelpID, strUniqueID, nMsgBoxStyleEx, nTimeoutSeconds, bIsDisabledTimeout, pBmpIcon );
}

ˆ
|

DentalVox.h

class CDentalVoxApp : public CWinApp
{
public:
=>	IMPLEMENT_CWinAPP_DoMessageBox;
	CDentalVoxApp();
	~CDentalVoxApp();


Thank you,

Tom

Tommaso Chiarelli Oct 5, 2010 - 2:02 AM

You were right. I initially thought it was related to ProfUIS in consideration of last involved calls in call stack, but it was due to a lack of release of DCs in some hidden and less important, but massively repeated (cause rendering related), methods of mine.

Problem solved.

Thank you very much,
Tom

Technical Support Sep 24, 2010 - 10:16 AM

Thank you for providing us with detailed information about the crashes. They are related to the NULL values of HDC handles. The MFC’s CDC / CWindowDC use the GetDC() Win32 API. This API can return NULL only if the GDI subsystem is overloaded. The normal application typically never overloads GDI. The most often GDI is overloading situation is GDI handle leaks. The GDI is completely overloaded if an application allocated 10000 (ten thousands) GDI handles of any type (HBRUSH, HPEN, HBITMAP, HDC). You can see the number of GDI handles allocated by any application in the standard Windows Task Manager (invoked by Ctrl+Shift+Esc). The Processes tab page contains table of running processes and you can add the GDI Handles column in it. Normal application should not allocate several thousands of GDI handles. This is not good.

Additionally, such a crash may occur due to incorrect usage of the GDI subsystem APIs. The GDI is not multithreaded in any Windows OS version. The Prof-UIS library is also not multithreaded as result of GDI implementation. You can use Prof-UIS APIs and classes only in one thread which is typically the main application’s thread.