MFC Ribbon quick access toolbar crash when state is changed - c++

I have an old MFC application I am updating and I just added a ribbon (using the CMFCRibbonBar class).
However any commands in the quick access toolbar on the ribbon that cause a change in state (eg closing the file and exiting to the main menu) cause a crash when the command is used from the quick access toolbar but not the normal ribbon button.
The crash happens in the MFC file afxribbonbar.cpp in OnMouseMove()
if (pHit != m_pHighlighted)
{
PopTooltip();
if (m_pHighlighted != NULL)
{
ASSERT_VALID(m_pHighlighted);
m_pHighlighted->m_bIsHighlighted = FALSE;
m_pHighlighted->OnHighlight(FALSE);
InvalidateRect(m_pHighlighted->GetRect());
m_pHighlighted = NULL;
}
It crashes on the InvalidateRect line, because m_pHighlighted seems to exist but have no data, so either the stack is corrupted or m_pHighlighted doesn't exist anymore.
I have some lines to reload where all the frames were last time the user was in the new state and I found if I comment out the lines when I change state the crash doesn't happen:
theApp.SaveState(this, ToolbarKey(i_oldAppState));
and
theApp.LoadState( this, ToolbarKey(i_newAppState) );
But ideally I want these lines as otherwise all the windows and frames revert to their default state and users have to resize everything again.
It feels like the entries in the quick access toolbar are being destroyed and recreated when I change state, but I can't find where MFC does this, or a way to set the highlighted entry to null.
EDIT: The crash is an unhandled exception due to an access reading violation in mfc140u.dll. The crash happens deep in the MFC code, well away from anything I have written.
The call stack when this unhandled exception occurs is:
mfc140u.dll!CBasePane::get_accValue(tagVARIANT varChild, wchar_t * * pszValue) Line 1494 C++
mfc140u.dll!CMFCRibbonBar::OnMouseMove(unsigned int nFlags, CPoint point) Line 2348 C++
mfc140u.dll!CMFCRibbonBar::OnLButtonUp(unsigned int nFlags, CPoint point) Line 2276 C++
mfc140u.dll!CWnd::OnWndMsg(unsigned int message, unsigned __int64 wParam, __int64 lParam, __int64 * pResult) Line 2698 C++
mfc140u.dll!CWnd::WindowProc(unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 2099 C++
mfc140u.dll!CBasePane::WindowProc(unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 1020 C++
mfc140u.dll!CMFCRibbonBar::WindowProc(unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 4884 C++
mfc140u.dll!AfxCallWndProc(CWnd * pWnd, HWND__ * hWnd, unsigned int nMsg, unsigned __int64 wParam, __int64 lParam) Line 265 C++
mfc140u.dll!AfxWndProc(HWND__ * hWnd, unsigned int nMsg, unsigned __int64 wParam, __int64 lParam) Line 417 C++
mfc140u.dll!AfxWndProcBase(HWND__ * hWnd, unsigned int nMsg, unsigned __int64 wParam, __int64 lParam) Line 299 C++
user32.dll!UserCallWinProcCheckWow() Unknown
user32.dll!DispatchMessageWorker() Unknown
user32.dll!IsDialogMessageW() Unknown
mfc140u.dll!CWnd::IsDialogMessageW(tagMSG * lpMsg) Line 194 C++
[Inline Frame] mfc140u.dll!CWnd::PreTranslateInput(tagMSG *) Line 4606 C++
mfc140u.dll!CBasePane::PreTranslateMessage(tagMSG * pMsg) Line 1057 C++
mfc140u.dll!CMFCRibbonBar::PreTranslateMessage(tagMSG * pMsg) Line 3734 C++
mfc140u.dll!CWnd::WalkPreTranslateTree(HWND__ * hWndStop, tagMSG * pMsg) Line 3379 C++
mfc140u.dll!AfxInternalPreTranslateMessage(tagMSG * pMsg) Line 233 C++
mfc140u.dll!AfxInternalPumpMessage() Line 178 C++
mfc140u.dll!CWinThread::Run() Line 629 C++

I had the same bug in the BCG Library. I Made my private fix there for the variables m_pHighlighted and m_pPressed.
BOOL CBCGPRibbonBar::LoadState (LPCTSTR lpszProfileName, int nIndex, UINT uiID)
{
// 2014-04-23 mri: we need to clear pointer to may be active elements that
// may get deleted, when LoadState is executed.
// We cannot set m_pActiveCategory to NULL!!!! This get us into problems when the
// program starts and the minimize/maximize button is used, when this pointer is
// NULL.
m_pHighlighted = NULL;
m_pPressed = NULL;
You should set them to nullptr before you call LoadState
As I remember the problem ist that a click in the ribbon is handled in the Mouse-Down message. So the Mouse-Up message is never executed that clears this member...

Related

pWnd read access violation on Windows version 20H2

I am running into a very strange issue with my mfc c++ program on newer Windows 10 builds. Specifically 20H2 (Build 19042).
When launching a specific dialog from my main menu PCs running this OS build crash silently, without warning.
I have gained access to dump files and determined the issue to be
"Unhandled exception thrown: read access violation. pWnd -> was 0x33312E" with exception code 0xC0000005
This was thrown inside of wincore.cpp on line 265
IResult = pWnd->WindowProc(nMsg, wParam, lParam);
Looking at the disassembly for this line it fails here...
0053A92C mov eax,dword ptr [pWnd] (pWnd is 0x0019f4a4)
0053A92F mov ecx,dword ptr [eax] (eax is 0x0019f4a4)
(ecx is 0x0033312E)
0053A931 mov edx,dword ptr [ecx+11Ch] (Unhandled exception here)
Call stack looks like this.
Program.exe!AfxCallWndProc(CWnd* pWnd, HWND__* hand, unsigned int nMsg, unsigned int wParam, long iParam) line 265
Program.exe!AfxWndProc(HWND__* hWnd, unsigned int nMsg, unsigned int wParam,long iParam) line 418
user32.dll!__InternalCallWinProc#20()
user32.dll!UserCallWinProcCheckWow()
user32.dll!DispatchClientMessage()
user32.dll!___fnDWORD#4()
ntdll.dll!_KiUserCallbackDispatcher#12()
Program.exe!CWND::UpdateWindow() line 106
Program.exe!CWND::RunModalLoop(unsigned long dwFlags) line 4632
Program.exe!CWND::CreateRunDlgIndirect(const DLGTEMPLATE * lpDialogTemplate, CWnd* pParentWnd, HINSTANCE__ * hInst) line 470
Program.exe!CDialog::DoModal() line 633
Program.exe!CMainDlg::OnDeviceButton() line 1271
Here is the code in OnDeviceButton()
Void CMainDlg::OnDeviceButton()
{
CDevice device;
device.deviceType = 7;
device.DoModal();
}
Here is code from CDevice
BOOL CDevice::OnInitDialog()
{
CDialog::OnInitDialog();
CloseCPC();
deviceList.SetExtendedStyle(LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT);
deviceList.InsertVolumn(0, _T("Device"), LVCFMT_LEFT, 150);
deviceList.InsertColumn(1, _T("Software Version"), LVCFMT_CENTER. 100);
deviceList.InsertItem(0, _T("BRTB"));
SetupVersionTree();
SetTimer(1,1,NULL);
Sleep(20);
return TRUE;
}
Void CDevice::OnTimer(UINT_PTR nIDEvent)
{
If(nODEvent == 1)
{
KillTimer(1);
If(CPC_handle == -1)
{
InitCPC(7,this);
}
If(firstPass)
{
GetVersion();
}
SetTimer(1,10000,NULL);
}
}
Any ideas? I've run through about everything I can think of for debugging besides submitting a help ticket directly to Microsoft asking for assistance.
If there is any other information I can provide please let me know.
Edit
I forgot to mention "solutions" that I have found.
Initialization if the class object as a pointer
CDevice* device = new CDevice();
A random development version which only difference is a new dialog item. (No longer crashes with this version)
Setting the timer up in InitDialog method after 20ms sleep.
Initializing two CPC msg structures in constructor.
These all individually "resolve" the issue but I cannot seem to find any patterns between these "solutions" and I can't sell them as a solution with the reason of "because it seems to fix it".

Access Violation during MFC execution of CFrameWnd::InitialUpdateFrame

I am in the process of trying to upgrade a VC++ 6.0 project to the latest version and am running into an issue. The program starts up fine but in the process of creating two child windows within the main view it crashes with an access violation. When run in debug mode it cannot find the exact location where the error occurs, displaying "Frame not in module" and "The current stack frame was not found in a loaded module. Source cannot be shown for this location" making it difficult to pinpoint the exact issue.
Going through the program step by step reveals that the error lies in the call of
CFrameWnd::InitialUpdateFrame.
From there it goes into the following functions:
Main.cpp:
frame->InitialUpdateFrame(dc, TRUE);
winfrm.cpp:
SendMessageToDescendants(WM_INITIALUPDATE, 0, 0, TRUE, TRUE);
afxwin2.inl:
CWnd::SendMessageToDescendants(m_hWnd, message, wParam, lParam, bDeep, bOnlyPerm);
wincore.cpp:
SendMessageToDescendants(hWndChild, message, wParam, lParam, bDeep, bOnlyPerm);
(Recursion to same function, error occurs on second recursion)
wincore.cpp:
AfxCallWndProc(pWnd, pWnd->m_hWnd, message, wParam, lParam);
Error has occurred at 3 of the following locations:
wincore.cpp:
_AfxPreInitDialog(pWnd, &rectOld, &dwStyle);
lResult = pWnd->WindowProc(nMsg, wParam, lParam);
_AfxPostInitDialog(pWnd, rectOld, dwStyle);
It is called from this function (simplified):
CDocument* XApp::OpenDocumentFile(LPCTSTR lpszFileName)
{
doc_x_spc *dc =
static_cast<doc_x_spc *> ( m_spc_template->CreateNewDocument() );
CMDIChildWnd *frame =
static_cast<CMDIChildWnd *> ( m_spc_template->CreateNewFrame(dc, NULL) );
if ( !dc->OnOpenDocument(lpszFileName) )
{
AfxMessageBox( IDS_SPCOPENERROR, MB_OK, NULL );
return NULL;
}
CString raw(lpszFileName);
dc->set_raw_file(raw);
frame->InitialUpdateFrame(dc, TRUE);
if (app_multiplexed == SINGLE)
menu.LoadMenu(IDR_REMPLETYPE_SINGLE);
else
menu.LoadMenu(IDR_REMPLETYPE);
CMainFrame* pMainFrame = (CMainFrame *)m_pMainWnd;
pMainFrame->MDISetMenu(&menu, NULL);
return dc;
}
The access violation produces this exact error:
Exception thrown at 0x01144008 in X.exe: 0xC0000005: Access violation executing location 0x01144008.
Would appreciate any help. Thank you!

Resolving an exception with LoadToolbarEx and difference between count of normal v large images

I just tried running my CDialog app in debug and I get an exception. It relates to my creation of myu toolbar.
I call this mention in OnInitDialog:
void CMeetingScheduleAssistantDlg::CreateToolbar()
{
DWORD dwCtrlStyle = TBSTYLE_FLAT | TBSTYLE_TOOLTIPS | CBRS_SIZE_DYNAMIC;
DWORD dwStyle = AFX_DEFAULT_TOOLBAR_STYLE;
if (m_ToolBar.CreateEx(this, dwCtrlStyle,
dwStyle, CRect(1, 1, 1, 1), IDR_TOOLBAR))
{
dwStyle = CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC;
m_ToolBar.SetPaneStyle(m_ToolBar.GetPaneStyle() | dwStyle);
CMFCToolBarInfo info;
info.m_uiColdResID = IDB_PNG_MAIN_TOOLBAR;
info.m_uiHotResID = IDB_PNG_MAIN_TOOLBAR;
info.m_uiLargeColdResID = IDB_PNG_MAIN_TOOLBAR;
info.m_uiLargeHotResID = IDB_PNG_MAIN_TOOLBAR;
m_ToolBar.LoadToolBarEx(IDR_TOOLBAR, info, FALSE);
CSize sizeToolBar = m_ToolBar.CalcFixedLayout(TRUE, TRUE);
m_ToolBar.SetWindowPos(NULL, 0, 0, sizeToolBar.cx, sizeToolBar.cy,
SWP_NOACTIVATE | SWP_NOZORDER);
// Move all controls down
CPoint ptOffset(0, sizeToolBar.cy);
CRect rcChild;
CWnd* pwndChild = GetWindow(GW_CHILD);
while (pwndChild)
{
if (pwndChild->GetSafeHwnd() != m_ToolBar.GetSafeHwnd())
{
pwndChild->GetWindowRect(rcChild);
ScreenToClient(rcChild);
rcChild.OffsetRect(ptOffset);
pwndChild->MoveWindow(rcChild, FALSE);
}
pwndChild = pwndChild->GetNextWindow();
}
// Resize the window
CRect rcWindow;
GetWindowRect(rcWindow);
rcWindow.bottom += sizeToolBar.cy;
MoveWindow(rcWindow, FALSE);
}
}
The exception is on this line:
LoadToolBarEx
When I trace the code I end up at this ASSERT:
// Load large images:
if (params.m_uiLargeHotResID != 0)
{
if (!m_LargeImages.Load(params.m_uiLargeHotResID, NULL, TRUE))
{
return FALSE;
}
ASSERT(m_Images.GetCount() == m_LargeImages.GetCount());
}
When I view these variables:
m_Images has 10 images.
m_LargeImages has 5 images.
This is the call stack:
> Meeting Schedule Assistant.exe!CMFCToolBar::LoadBitmapEx(CMFCToolBarInfo & params, int bLocked) Line 781 C++
Meeting Schedule Assistant.exe!CMFCToolBar::LoadToolBarEx(unsigned int uiToolbarResID, CMFCToolBarInfo & params, int bLocked) Line 872 C++
Meeting Schedule Assistant.exe!CMeetingScheduleAssistantDlg::CreateToolbar() Line 2288 C++
Meeting Schedule Assistant.exe!CMeetingScheduleAssistantDlg::OnInitDialog() Line 246 C++
Meeting Schedule Assistant.exe!AfxDlgProc(HWND__ * hWnd, unsigned int message, unsigned __int64 __formal, __int64 __formal) Line 28 C++
[External Code]
Meeting Schedule Assistant.exe!CWnd::DefWindowProcW(unsigned int nMsg, unsigned __int64 wParam, __int64 lParam) Line 1100 C++
Meeting Schedule Assistant.exe!CWnd::Default() Line 299 C++
Meeting Schedule Assistant.exe!CDialog::HandleInitDialog(unsigned __int64 __formal, __int64 __formal) Line 721 C++
Meeting Schedule Assistant.exe!CWnd::OnWndMsg(unsigned int message, unsigned __int64 wParam, __int64 lParam, __int64 * pResult) Line 2441 C++
Meeting Schedule Assistant.exe!CWnd::WindowProc(unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 2099 C++
Meeting Schedule Assistant.exe!AfxCallWndProc(CWnd * pWnd, HWND__ * hWnd, unsigned int nMsg, unsigned __int64 wParam, __int64 lParam) Line 265 C++
Meeting Schedule Assistant.exe!AfxWndProc(HWND__ * hWnd, unsigned int nMsg, unsigned __int64 wParam, __int64 lParam) Line 418 C++
[External Code]
Meeting Schedule Assistant.exe!IsolationAwareCreateDialogIndirectParamW(HINSTANCE__ * hInstance, const DLGTEMPLATE * lpTemplate, HWND__ * hWndParent, __int64(*)(HWND__ *, unsigned int, unsigned __int64, __int64) lpDialogFunc, __int64 dwInitParam) Line 569 C++
Meeting Schedule Assistant.exe!CWnd::CreateDlgIndirect(const DLGTEMPLATE * lpDialogTemplate, CWnd * pParentWnd, HINSTANCE__ * hInst) Line 358 C++
Meeting Schedule Assistant.exe!CWnd::CreateRunDlgIndirect(const DLGTEMPLATE * lpDialogTemplate, CWnd * pParentWnd, HINSTANCE__ * hInst) Line 460 C++
Meeting Schedule Assistant.exe!CDialog::DoModal() Line 633 C++
Meeting Schedule Assistant.exe!CMeetingScheduleAssistantApp::InitInstance() Line 251 C++
Meeting Schedule Assistant.exe!AfxWinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, wchar_t * lpCmdLine, int nCmdShow) Line 37 C++
Meeting Schedule Assistant.exe!wWinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, wchar_t * lpCmdLine, int nCmdShow) Line 26 C++
[External Code]
My main PNG toolbar resource has 10 images. Yet I specified this code:
info.m_uiColdResID = IDB_PNG_MAIN_TOOLBAR;
info.m_uiHotResID = IDB_PNG_MAIN_TOOLBAR;
info.m_uiLargeColdResID = IDB_PNG_MAIN_TOOLBAR;
info.m_uiLargeHotResID = IDB_PNG_MAIN_TOOLBAR;
My toolbar image is 320 x 32.
How do I deal with this exception?
I think I have come across the answer here.
CMFCToolBar::m_dblLargeImageRatio
Specifies the ratio between the dimension (height or width) of large
images and the dimension of regular images.
Remarks The default ratio is 2. You can change this value to make
large toolbar images larger or smaller.
The framework uses this data member when you do not specify a set of
large images. For example, if you provide only the set of small images
with size 16x16 and want the large images to have the size 24x24, set
this data member to 1.5.
CMFCToolBar::m_dblLargeImageRatio = 1.0;

How to let the VS2013 call stack show more functions

In my MFC program, I need to parse a 1.2GB file.During debugging, every time the program near the completion of parsing,it will has an exception as follows:
First-chance exception at 0x522C31CA (msvcr120d.dll) in LogDataTrans.exe: 0xC0000005: Access violation writing location 0x0003FA0C.
Here is the last function in call stack:msvcr120d.dll!memcpy(unsigned char * dst, unsigned char * src, unsigned long count) Line 188 Unknown.But other functions in the call stack are defined in mfc120d and user32.dll.I have changed the code from memcpy(&_lrs.body[_lrs.lenBody], buf, l); to
try{
memcpy(&_lrs.body[_lrs.lenBody], buf, l);
}
catch (...){
ofstream f("memcpy.error");
f << "memcpy.error";
}
But the same problem occurred.Also,this memcpy function has been used many times before the exception occurs.
I can't find elsewhere my own code is wrong.So, I want to let the call stack show more functions to let me trace back to my own functions,not only functions provided by the system.The current call stack is this:
msvcr120d.dll!memcpy(unsigned char * dst, unsigned char * src, unsigned long count) Line 188 Unknown
LogDataTrans.exe!AfxWinMain(struct HINSTANCE__ *,struct HINSTANCE__ *,char *,int) C++
mfc120d.dll!_AfxDispatchCmdMsg(CCmdTarget * pTarget, unsigned int nID, int nCode, void (void) * pfn, void * pExtra, unsigned int nSig, AFX_CMDHANDLERINFO * pHandlerInfo) Line 77 C++
mfc120d.dll!CCmdTarget::OnCmdMsg(unsigned int nID, int nCode, void * pExtra, AFX_CMDHANDLERINFO * pHandlerInfo) Line 373 C++
mfc120d.dll!CDialog::OnCmdMsg(unsigned int nID, int nCode, void * pExtra, AFX_CMDHANDLERINFO * pHandlerInfo) Line 85 C++
mfc120d.dll!CWnd::OnCommand(unsigned int wParam, long lParam) Line 2784 C++
mfc120d.dll!CDialogEx::OnCommand(unsigned int wParam, long lParam) Line 290 C++
mfc120d.dll!CWnd::OnWndMsg(unsigned int message, unsigned int wParam, long lParam, long * pResult) Line 2108 C++
mfc120d.dll!CWnd::WindowProc(unsigned int message, unsigned int wParam, long lParam) Line 2094 C++
mfc120d.dll!AfxCallWndProc(CWnd * pWnd, HWND__ * hWnd, unsigned int nMsg, unsigned int wParam, long lParam) Line 282 C++
mfc120d.dll!AfxWndProc(HWND__ * hWnd, unsigned int nMsg, unsigned int wParam, long lParam) Line 435 C++
mfc120d.dll!AfxWndProcBase(HWND__ * hWnd, unsigned int nMsg, unsigned int wParam, long lParam) Line 299 C++
user32.dll!_InternalCallWinProc#20() Unknown
user32.dll!_UserCallWinProcCheckWow#32() Unknown
user32.dll!_SendMessageWorker#24() Unknown
user32.dll!_SendMessageW#16() Unknown
user32.dll!_xxxButtonNotifyParent#12() Unknown
user32.dll!_xxxBNReleaseCapture#12() Unknown
user32.dll!_ButtonWndProcWorker#24() Unknown
user32.dll!_ButtonWndProcA#16() Unknown
user32.dll!_InternalCallWinProc#20() Unknown
user32.dll!_UserCallWinProcCheckWow#32() Unknown
user32.dll!_DispatchMessageWorker#8() Unknown
user32.dll!_DispatchMessageW#4() Unknown
user32.dll!_IsDialogMessageW#8() Unknown
user32.dll!_IsDialogMessageA#8() Unknown
mfc120d.dll!CWnd::IsDialogMessageA(tagMSG * lpMsg) Line 193 C++
mfc120d.dll!CWnd::PreTranslateInput(tagMSG * lpMsg) Line 4590 C++
mfc120d.dll!CDialog::PreTranslateMessage(tagMSG * pMsg) Line 80 C++
mfc120d.dll!CDialogEx::PreTranslateMessage(tagMSG * pMsg) Line 275 C++
mfc120d.dll!CWnd::WalkPreTranslateTree(HWND__ * hWndStop, tagMSG * pMsg) Line 3363 C++
mfc120d.dll!AfxInternalPreTranslateMessage(tagMSG * pMsg) Line 233 C++
mfc120d.dll!CWinThread::PreTranslateMessage(tagMSG * pMsg) Line 777 C++
mfc120d.dll!AfxPreTranslateMessage(tagMSG * pMsg) Line 252 C++
mfc120d.dll!AfxInternalPumpMessage() Line 178 C++
mfc120d.dll!CWinThread::PumpMessage() Line 900 C++
mfc120d.dll!AfxPumpMessage() Line 190 C++
mfc120d.dll!CWnd::RunModalLoop(unsigned long dwFlags) Line 4644 C++
mfc120d.dll!CWnd::CreateRunDlgIndirect(const DLGTEMPLATE * lpDialogTemplate, CWnd * pParentWnd, HINSTANCE__ * hInst) Line 470 C++
mfc120d.dll!CDialog::DoModal() Line 633 C++
LogDataTrans.exe!CLogDataTransApp::InitInstance() Line 75 C++
[External Code]
LogDataTrans.exe!WinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, char * lpCmdLine, int nCmdShow) Line 26 C++
All these functions are not defined by me.

MFC program crashes when window resized with error "A required resource was not found."

I'm developing an SDI MFC application where there are some custom buttons which are drawn in a custom way or have images loaded on top of them. When the running application is re-sized continuously for about 5 to 10 minutes, it crashes with the error "A required resource was not found."
I have checked the code thoroughly and all the GetDC() calls are followed by ReleaseDC() calls. Furthermore, I always save the old GDI object (for example, an oldBrush), whenever I do a DC.SelectObject(&newBrush) call and then restore the old pen with DC.SelectObject(&oldBrush).
Any hints for what else might be causing this error?
Edit: I used the program Deleaker to find the GDI leaks in the program and deleted those GDI objects which were causing the leak.
Edit: Here's the call stack for AfxThrowResourceException:
mfc110ud.dll!AfxThrowResourceException() Line 1353 C++
mfc110ud.dll!CWindowDC::CWindowDC(CWnd * pWnd) Line 1022 C++
mfc110ud.dll!CMFCToolBarImages::PrepareDrawImage(tagAFXDrawState & ds, CSize sizeImageDest, int bFadeInactive) Line 1219 C++
mfc110ud.dll!CMFCToolBarImages::DrawEx(CDC * pDC, CRect rect, int iImageIndex, CMFCToolBarImages::ImageAlignHorz horzAlign, CMFCToolBarImages::ImageAlignVert vertAlign, CRect rectSrc, unsigned char alphaSrc) Line 1729 C++
mfc110ud.dll!CMFCControlRenderer::FillInterior(CDC * pDC, CRect rect, CMFCToolBarImages::ImageAlignHorz horz, CMFCToolBarImages::ImageAlignVert vert, unsigned int index, unsigned char alphaSrc) Line 470 C++
mfc110ud.dll!CMFCControlRenderer::FillInterior(CDC * pDC, CRect rect, unsigned int index, unsigned char alphaSrc) Line 474 C++
mfc110ud.dll!CMFCControlRenderer::Draw(CDC * pDC, CRect rect, unsigned int index, unsigned char alphaSrc) Line 253 C++
mfc110ud.dll!CMFCVisualManagerOffice2007::DrawNcCaption(CDC * pDC, CRect rectCaption, unsigned long dwStyle, unsigned long dwStyleEx, const ATL::CStringT<wchar_t,StrTraitMFC_DLL<wchar_t,ATL::ChTraitsCRT<wchar_t> > > & strTitle, const ATL::CStringT<wchar_t,StrTraitMFC_DLL<wchar_t,ATL::ChTraitsCRT<wchar_t> > > & strDocument, HICON__ * hIcon, int bPrefix, int bActive, int bTextCenter, const CObList & lstSysButtons) Line 2097 C++
mfc110ud.dll!CMFCVisualManagerOffice2007::OnNcPaint(CWnd * pWnd, const CObList & lstSysButtons, CRect rectRedraw) Line 2343 C++
mfc110ud.dll!CFrameImpl::OnNcPaint() Line 1564 C++
mfc110ud.dll!CFrameWndEx::OnNcPaint() Line 1030 C++
mfc110ud.dll!CWnd::OnWndMsg(unsigned int message, unsigned int wParam, long lParam, long * pResult) Line 2459 C++
mfc110ud.dll!CWnd::WindowProc(unsigned int message, unsigned int wParam, long lParam) Line 2137 C++
mfc110ud.dll!AfxCallWndProc(CWnd * pWnd, HWND__ * hWnd, unsigned int nMsg, unsigned int wParam, long lParam) Line 290 C++
mfc110ud.dll!AfxWndProc(HWND__ * hWnd, unsigned int nMsg, unsigned int wParam, long lParam) Line 453 C++
mfc110ud.dll!AfxWndProcBase(HWND__ * hWnd, unsigned int nMsg, unsigned int wParam, long lParam) Line 304 C++
I am sure you have a GDI or other Windows resource leak. The message text Comes from an internal exception in the MFC.
What you see is the result of a call to AfxThrowResourceException. Set a break Point on this function in the Debugger and you can see what Operation Fails.
As a result of this acion you know if you have a Memory or GDI leak, or may be other handle leak...