Crash ribbon when PC enter in sleep/standby mode
-
Hi all I have a big problem, when Windows Xp, Vista or Win7 enter in sleep/stand by mode, my software crash in restart. I found where is the problem, the problem is in ribbon bar. I have a MDI application based in ribbon Office 2007, but my mainframe run in another thread where is the ribbonbar and initialization. I have a derived class of CWinthread where is my CMainframe, this is necessary because of software type. In my tests I found: CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_LunaBlue); CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOffice2007)); This I set in OnCreate() function of my Mainframe, in tests I can see that problem is only when I choose CMFCVisualManagerOffice2007, there are no problem for the others, Office 2003, XP, VS2005. Im using in development environment WINXP, VS2008 SP1. Anybody can help me? Do you have seen this before? Thank you
-
Hi all I have a big problem, when Windows Xp, Vista or Win7 enter in sleep/stand by mode, my software crash in restart. I found where is the problem, the problem is in ribbon bar. I have a MDI application based in ribbon Office 2007, but my mainframe run in another thread where is the ribbonbar and initialization. I have a derived class of CWinthread where is my CMainframe, this is necessary because of software type. In my tests I found: CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_LunaBlue); CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOffice2007)); This I set in OnCreate() function of my Mainframe, in tests I can see that problem is only when I choose CMFCVisualManagerOffice2007, there are no problem for the others, Office 2003, XP, VS2005. Im using in development environment WINXP, VS2008 SP1. Anybody can help me? Do you have seen this before? Thank you
You could try to empty the
WM_POWERBROADCAST
reaction of your frame (1, rudely) or to debug theCMFCVisualManagerOffice2007::OnUpdateSystemColors()
after the logon... ...to find the responsible for the crash line and then - to derive your own class from Off2007VManager with some overwritten virtualities (2) :)virtual void BeHappy() = 0;
-
You could try to empty the
WM_POWERBROADCAST
reaction of your frame (1, rudely) or to debug theCMFCVisualManagerOffice2007::OnUpdateSystemColors()
after the logon... ...to find the responsible for the crash line and then - to derive your own class from Off2007VManager with some overwritten virtualities (2) :)virtual void BeHappy() = 0;
-
So, now the problem is how to use my derived class in MainFrame. I can't use : CMFCVisualManager::SetDefaultManager (RUNTIME_CLASS (CMFCMyVisualManagerOffice2007)); My application still crash.
// I can't use Why ? :)
virtual void BeHappy() = 0;
-
// I can't use Why ? :)
virtual void BeHappy() = 0;
Here is my derived class: class CMFCMyVisualManagerOffice2007 : public CMFCVisualManagerOffice2007 { DECLARE_DYNCREATE(CMFCMyVisualManagerOffice2007) public: CMFCMyVisualManagerOffice2007(); virtual ~CMFCMyVisualManagerOffice2007(); virtual void OnUpdateSystemColors() { m_bAutoFreeRes = bAutoFree; } }; IMPLEMENT_DYNAMIC(CMFCMyVisualManagerOffice2007, CMFCVisualManagerOffice2007) So, in OnCreate of CMainframe: CMFCMyVisualManagerOffice2007::SetStyle (CMFCMyVisualManagerOffice2007::Office2007_LunaBlue); CMFCVisualManager::SetDefaultManager (RUNTIME_CLASS (CMFCMyVisualManagerOffice2007));// this line crash application
-
Here is my derived class: class CMFCMyVisualManagerOffice2007 : public CMFCVisualManagerOffice2007 { DECLARE_DYNCREATE(CMFCMyVisualManagerOffice2007) public: CMFCMyVisualManagerOffice2007(); virtual ~CMFCMyVisualManagerOffice2007(); virtual void OnUpdateSystemColors() { m_bAutoFreeRes = bAutoFree; } }; IMPLEMENT_DYNAMIC(CMFCMyVisualManagerOffice2007, CMFCVisualManagerOffice2007) So, in OnCreate of CMainframe: CMFCMyVisualManagerOffice2007::SetStyle (CMFCMyVisualManagerOffice2007::Office2007_LunaBlue); CMFCVisualManager::SetDefaultManager (RUNTIME_CLASS (CMFCMyVisualManagerOffice2007));// this line crash application
Does it crash at the initial starting or after the standby mode ? Try to comment your implementation for
virtual void OnUpdateSystemColors()
firstly, then, when it will not crash, try to modify it slowly, for example :) :/*virtual*/ void COurVisualManagerOffice2007::OnUpdateSystemColors()
{
CYourApp* pcApp = (CYourApp*) AfxGetApp();
ASSERT(pcApp);if (pcApp) {
// "Restoring" of the initial state...
switch (pcApp->m_nAppLook) {
case ID_VIEW_APPLOOK_OFF_2007_BLUE:
CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_LunaBlue);
break;
case ID_VIEW_APPLOOK_OFF_2007_BLACK:
CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_ObsidianBlack);
break;
case ID_VIEW_APPLOOK_OFF_2007_SILVER:
CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_Silver);
break;
case ID_VIEW_APPLOOK_OFF_2007_AQUA:
CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_Aqua);
break;
}
}CMFCVisualManagerOffice2007::OnUpdateSystemColors();
}virtual void BeHappy() = 0;
-
Does it crash at the initial starting or after the standby mode ? Try to comment your implementation for
virtual void OnUpdateSystemColors()
firstly, then, when it will not crash, try to modify it slowly, for example :) :/*virtual*/ void COurVisualManagerOffice2007::OnUpdateSystemColors()
{
CYourApp* pcApp = (CYourApp*) AfxGetApp();
ASSERT(pcApp);if (pcApp) {
// "Restoring" of the initial state...
switch (pcApp->m_nAppLook) {
case ID_VIEW_APPLOOK_OFF_2007_BLUE:
CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_LunaBlue);
break;
case ID_VIEW_APPLOOK_OFF_2007_BLACK:
CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_ObsidianBlack);
break;
case ID_VIEW_APPLOOK_OFF_2007_SILVER:
CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_Silver);
break;
case ID_VIEW_APPLOOK_OFF_2007_AQUA:
CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_Aqua);
break;
}
}CMFCVisualManagerOffice2007::OnUpdateSystemColors();
}virtual void BeHappy() = 0;
Ok, this works in first time that I go in sleep/stand by mode. In second time my application crash in the same way. Im using Windbg to see stack. Here is my stack, the problem happens in release/debug version. 02dcf92c 78bbdb80 mfc90u!AfxFindResourceHandle+0x15 [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\dllinit.cpp @ 237] 02dcf94c 78bb8b74 mfc90u!CPngImage::Load+0x2e [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\afxtoolbarimages.cpp @ 3141] 02dcf9f8 78b38b3d mfc90u!CMFCToolBarImages::LoadStr+0xca [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\afxtoolbarimages.cpp @ 199] 02dcfb20 78bd2e4e mfc90u!CMenuImages::SetColor+0x7e [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\afxmenuimages.cpp @ 111] 02dcfb50 78bd2d33 mfc90u!CMFCVisualManagerOffice2007::~CMFCVisualManagerOffice2007+0x27 [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\afxvisualmanageroffice2007.cpp @ 305] 02dcfb5c 78bc4772 mfc90u!CMFCVisualManagerOffice2007::`scalar deleting destructor'+0xd 02dcfb6c 78b23736 mfc90u!CMFCVisualManager::SetDefaultManager+0x34 [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\afxvisualmanager.cpp @ 159] 02dcfb80 78b20b95 mfc90u!AFX_GLOBAL_DATA::Resume+0x138 [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\afxglobals.cpp @ 1254] 02dcfb8c 78a3f97c mfc90u!CFrameWndEx::OnPowerBroadcast+0x1d [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\afxframewndex.cpp @ 1164] 02dcfc3c 78a3f6ce mfc90u!CWnd::OnWndMsg+0x287 [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\wincore.cpp @ 1897] 02dcfc5c 78a3e2f4 mfc90u!CWnd::WindowProc+0x24 [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\wincore.cpp @ 1755] 02dcfcc4 78a3e580 mfc90u!AfxCallWndProc+0xa3 [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\wincore.cpp @ 240] 02dcfd2c 7e418734 mfc90u!AfxWndProc+0x37 [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\wincore.cpp @ 402] 02dcfd58 7e418816 USER32!InternalCallWinProc+0x28 02dcfdc0 7e428ea0 USER32!UserCallWinProcCheckWow+0x150 02dcfe14 7e428eec USER32!DispatchClientMessage+0xa3 02dcfe3c 7c90e473 USER32!__fnDWORD+0x24 02dcfe60 7e4193e9 ntdll!KiUserCallbackDispatcher+0x13 02dcfe8c 7e419402 USER32!NtUserPeekMessage+0xc 02dcfeb8 78a7ea72 USER32!PeekMessageW+0xbc 02dcfeec 78a7e337 mfc90u!CWinThread::Run+0x86 [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\thrdcore.cpp @ 640] 02dcff70 78543433 mfc90u!_AfxThreadEntry+0x10c [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\thrdcore.cpp @ 126] 02dcffa8 785434c7 MSVCR90!_callthreadstartex+0x1b [f:\dd\vctools\crt_bld\self_x86\crt\src\threadex.c @ 348] 02dcffb4 7c80b729 MSVCR90!_threadstartex+0x69 [f:\dd\vctools\crt_bld\self_x86\crt\src\threadex.c @ 326
-
Ok, this works in first time that I go in sleep/stand by mode. In second time my application crash in the same way. Im using Windbg to see stack. Here is my stack, the problem happens in release/debug version. 02dcf92c 78bbdb80 mfc90u!AfxFindResourceHandle+0x15 [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\dllinit.cpp @ 237] 02dcf94c 78bb8b74 mfc90u!CPngImage::Load+0x2e [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\afxtoolbarimages.cpp @ 3141] 02dcf9f8 78b38b3d mfc90u!CMFCToolBarImages::LoadStr+0xca [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\afxtoolbarimages.cpp @ 199] 02dcfb20 78bd2e4e mfc90u!CMenuImages::SetColor+0x7e [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\afxmenuimages.cpp @ 111] 02dcfb50 78bd2d33 mfc90u!CMFCVisualManagerOffice2007::~CMFCVisualManagerOffice2007+0x27 [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\afxvisualmanageroffice2007.cpp @ 305] 02dcfb5c 78bc4772 mfc90u!CMFCVisualManagerOffice2007::`scalar deleting destructor'+0xd 02dcfb6c 78b23736 mfc90u!CMFCVisualManager::SetDefaultManager+0x34 [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\afxvisualmanager.cpp @ 159] 02dcfb80 78b20b95 mfc90u!AFX_GLOBAL_DATA::Resume+0x138 [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\afxglobals.cpp @ 1254] 02dcfb8c 78a3f97c mfc90u!CFrameWndEx::OnPowerBroadcast+0x1d [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\afxframewndex.cpp @ 1164] 02dcfc3c 78a3f6ce mfc90u!CWnd::OnWndMsg+0x287 [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\wincore.cpp @ 1897] 02dcfc5c 78a3e2f4 mfc90u!CWnd::WindowProc+0x24 [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\wincore.cpp @ 1755] 02dcfcc4 78a3e580 mfc90u!AfxCallWndProc+0xa3 [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\wincore.cpp @ 240] 02dcfd2c 7e418734 mfc90u!AfxWndProc+0x37 [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\wincore.cpp @ 402] 02dcfd58 7e418816 USER32!InternalCallWinProc+0x28 02dcfdc0 7e428ea0 USER32!UserCallWinProcCheckWow+0x150 02dcfe14 7e428eec USER32!DispatchClientMessage+0xa3 02dcfe3c 7c90e473 USER32!__fnDWORD+0x24 02dcfe60 7e4193e9 ntdll!KiUserCallbackDispatcher+0x13 02dcfe8c 7e419402 USER32!NtUserPeekMessage+0xc 02dcfeb8 78a7ea72 USER32!PeekMessageW+0xbc 02dcfeec 78a7e337 mfc90u!CWinThread::Run+0x86 [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\thrdcore.cpp @ 640] 02dcff70 78543433 mfc90u!_AfxThreadEntry+0x10c [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\thrdcore.cpp @ 126] 02dcffa8 785434c7 MSVCR90!_callthreadstartex+0x1b [f:\dd\vctools\crt_bld\self_x86\crt\src\threadex.c @ 348] 02dcffb4 7c80b729 MSVCR90!_threadstartex+0x69 [f:\dd\vctools\crt_bld\self_x86\crt\src\threadex.c @ 326
Hmm... ...may be, it is not correctly to process
AFX_GLOBAL_DATA::Resume()
since it was initialized by the main thread (that is not my case). So you can empty/redirectCYourMainFrame::OnPowerBroadcast(..)
without the call ofCFrameWndEx::OnPowerBroadcast(..)
...virtual void BeHappy() = 0;