Print Page | Close Window

Error statically linking to V10.40

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=5900
Printed Date: 12 November 2025 at 12:54am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Error statically linking to V10.40
Posted By: snhd
Subject: Error statically linking to V10.40
Date Posted: 23 December 2006 at 12:28pm

First-chance exception in app.exe: 0xC0000005: Access Violation.
I am statically linking to CodeJock Lib. with #define _XTP_STATICLINK
when I compile GUI_Outlook sample in VC6.0 with #define _XTP_STATICLINK it also asserts

When I link with V10.31 everything works just fine.
 
The problem occurs while resizing the app.
void CMainFrame::OnSize(UINT nType, int cx, int cy)
{
 CXTPFrameWnd::OnSize(nType, cx, cy);
}


CXTPStatusBar.cpp
void CXTPStatusBar::OnWindowPosChanged(WINDOWPOS* lpwndpos)
{
 CControlBar::OnWindowPosChanged(lpwndpos);

 if (GetPaintManager()->BaseTheme() == xtpThemeRibbon)
<Access violation on the above line>

Output of Call Stack from my application :
CXTPStatusBar::OnWindowPosChanged(tagWINDOWPOS * 0x0012dffc) line 1360 + 14 bytes
CWnd::OnWndMsg(unsigned int 71, unsigned int 0, long 1236988, long * 0x0012dc2c) line 1954
CXTPStatusBar::OnWndMsg(unsigned int 71, unsigned int 0, long 1236988, long * 0x0012dc2c) line 1439
CWnd::WindowProc(unsigned int 71, unsigned int 0, long 1236988) line 1585 + 30 bytes
CControlBar::WindowProc(unsigned int 71, unsigned int 0, long 1236988) line 480 + 20 bytes
AfxCallWndProc(CWnd * 0x00345d50 {CXTPStatusBar hWnd=???}, HWND__ * 0x0001036c, unsigned int 71, unsigned int 0, long 1236988) line 215 + 26 bytes
AfxWndProc(HWND__ * 0x0001036c, unsigned int 71, unsigned int 0, long 1236988) line 368
AfxWndProcBase(HWND__ * 0x0001036c, unsigned int 71, unsigned int 0, long 1236988) line 220 + 21 bytes

Best Regards



Replies:
Posted By: Oleg
Date Posted: 24 December 2006 at 9:15am
I can't reproduce :( Maybe you didn't add toolkt resources.
 
in GUI_Outlook  try also add to res\GUI_Outlook.rc2" before #include "CodejockSample.rc"
#define _XTP_STATICLINK


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Kukis
Date Posted: 28 December 2006 at 11:00am
Problem is related to a new handler
void CXTPStatusBar::OnWindowPosChanged(WINDOWPOS* lpwndpos)
{
   CControlBar::OnWindowPosChanged(lpwndpos);
 
   if (GetPaintManager()->BaseTheme() == xtpThemeRibbon)
   {
   ...........
   }
}
 
Roots of the problem are GetPaintManager() call. It can return 0 if m_bCommandBarsTheme == FALSE
(at least i'm using this style, had to make quick fix myself)
 
CXTPPaintManager* CXTPStatusBar::GetPaintManager() const
{
   if (!m_bCommandBarsTheme)  <---------------------- here
      return NULL;
 
   if (m_pCommandBars)
      return m_pCommandBars->GetPaintManager();
   return XTPPaintManager();
}
 
Quick solution would be to change library and recompile, or add your own status bar and add handler
ON_WM_WINDOWPOSCHANGED() with check for NULL return:
 
void CStatusBarEx::OnWindowPosChanged(WINDOWPOS* lpwndpos)
{
   CControlBar::OnWindowPosChanged(lpwndpos);
 
   CXTPPaintManager* pManager = GetPaintManager();
   if (pManager && pManager->BaseTheme() == xtpThemeRibbon)
   {
   ...............
   }
}


Posted By: Oleg
Date Posted: 28 December 2006 at 3:10pm
Thanks. You right. Changed.

-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: snhd
Date Posted: 29 December 2006 at 2:57am
Hi Kukis
 
Thanks
Merry Christmas.
A very Happy & Prosperous New Year to you & all.



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