Print Page | Close Window

MFC assertion after skin change (force black text)

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=24132
Printed Date: 22 December 2024 at 12:26pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: MFC assertion after skin change (force black text)
Posted By: pvdhouten
Subject: MFC assertion after skin change (force black text)
Date Posted: 11 February 2021 at 3:06pm
Hello,

This is my first question posted on this forum.

I encounter an debug exception in MFC code after I change the skin of my application.
The application has lots of existing MFC components and I added a ribbon bar and docking pane manager to an MDI MainFrame.

The call stack leads to MFC code CControlBar::OnCtlColor with comments "force black text on gray background all the time". Inside CWnd::GrayCtlColor exists a verify assertion that fails:

VERIFY(::GetObject(hbrGray, sizeof(LOGBRUSH), (LPVOID)&logbrush));

The call stack after the skin change:

CWnd::GrayCtlColor(HDC__ * hDC, HWND__ * hWnd, unsigned int nCtlColor, HBRUSH__ * hbrGray, unsigned long clrText) Line 4356
CControlBar::OnCtlColor(CDC * pDC, CWnd * pWnd, unsigned int nCtlColor) Line 686
CWnd::OnWndMsg(unsigned int message, unsigned __int64 wParam, __int64 lParam, __int64 * pResult) Line 2341
CWnd::WindowProc(unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 2087
CControlBar::WindowProc(unsigned int nMsg, unsigned __int64 wParam, __int64 lParam) Line 506
CWnd::OnNTCtlColor(unsigned __int64 wParam, __int64 lParam) Line 1528
CWnd::OnWndMsg(unsigned int message, unsigned __int64 wParam, __int64 lParam, __int64 * pResult) Line 2383
CWnd::WindowProc(unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 2087
CControlBar::WindowProc(unsigned int nMsg, unsigned __int64 wParam, __int64 lParam) Line 506
AfxCallWndProc(CWnd * pWnd, HWND__ * hWnd, unsigned int nMsg, unsigned __int64 wParam, __int64 lParam) Line 257
AfxWndProc(HWND__ * hWnd, unsigned int nMsg, unsigned __int64 wParam, __int64 lParam) Line 420
  [External Code]
CXTPSkinManagerDetoursApiHook::OnHookDefDlgProcW(HWND__ * hWnd, unsigned int Msg, unsigned __int64 wParam, __int64 lParam) Line 1133
...
...
...
CXTPSkinManager::OnSkinChanged(int bPrevState, int bNewState) Line 1118

I am posting this question because I do not see any of our own code involved.
Do you have any idea what I might be doing wrong, or how I can continue to investigate (if it is a serious issue)? 

MFC version 10 (of toolkit v100 of Visual Studio 2010)
ToolKit Pro MFC: 19.3.0

Kind regards,
Peter





Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net