Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - [solved] Problem with docking pane icons v18.0.1
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

[solved] Problem with docking pane icons v18.0.1

 Post Reply Post Reply
Author
Message
lviolette View Drop Down
Groupie
Groupie
Avatar

Joined: 17 March 2007
Location: United States
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote lviolette Quote  Post ReplyReply Direct Link To This Post Topic: [solved] Problem with docking pane icons v18.0.1
    Posted: 29 November 2016 at 4:56pm
We have an SDI App that hosts in a DLL the mainframe and UI.  When we updated to CodeJock 17.2 from 15, the code that controls the drawing of docking pane icons, like the Pin and Close buttons changed to be resource based.

You can see the new code in XTPDrawhelpers::InitFont which gets called by XTPPrimitiveDrawer::DrawSymbol.

What happens is that InitFont gets called and my DLL is the current thread module (not the application EXE).  So, when InitFont calls AfxFindResourceHandle, it does not succeed in loading the ToolkitPro DLL and is not able to find XTP_IDC_FONT_CODEJOCK.  Thus, an ASSERT.

I have created a sample application/dll that demonstrates this problem.

Basically the docking pane icons look like this:

Instead of this:

To show that the icon should be here, here's what it looks like when I hover over where the icon should be:

I have created a sample visual studio project that re-creates the problem. You can extract it with WinRAR.

If you extract it so that the root folder is under the CodeJock\Samples folder, it "should" build the DLL and EXE to the correct CodeJock\bin folder.

Would appreciate if you have any advice.
L. Violette
Monolith
www.lith.com
Xtreme Toolkit Pro v22.1.0
Back to Top
Recomatics View Drop Down
Newbie
Newbie


Joined: 09 March 2017
Status: Offline
Points: 16
Answer Answer
Post Options Post Options   Thanks (2) Thanks(2)   Quote Recomatics Quote  Post ReplyReply Direct Link To This Post Posted: 09 March 2017 at 3:34am
Same problem here , 
changed the code of the ..\Source\Common\XTPDrawHelpers.cpp
to :
...
void CXTPPrimitiveDrawer::InitFont()
{
AFX_MANAGE_STATE(AfxGetAppModuleState());
if (NULL == m_hCodejockMemFont)
{
::EnterCriticalSection(&m_fontAccess);
if (NULL == m_hCodejockMemFont
... 


Back to Top
lviolette View Drop Down
Groupie
Groupie
Avatar

Joined: 17 March 2007
Location: United States
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote lviolette Quote  Post ReplyReply Direct Link To This Post Posted: 01 December 2016 at 7:51pm
I have confirmed that this continues to be a problem in version 17.3.

It appears that you can't use dynamic linking of toolkit AND host UI in a DLL instead of an EXE....


L. Violette
Monolith
www.lith.com
Xtreme Toolkit Pro v22.1.0
Back to Top
Recomatics View Drop Down
Newbie
Newbie


Joined: 09 March 2017
Status: Offline
Points: 16
Answer Answer
Post Options Post Options   Thanks (2) Thanks(2)   Quote Recomatics Quote  Post ReplyReply Direct Link To This Post Posted: 09 March 2017 at 3:34am
Same problem here , 
changed the code of the ..\Source\Common\XTPDrawHelpers.cpp
to :
...
void CXTPPrimitiveDrawer::InitFont()
{
AFX_MANAGE_STATE(AfxGetAppModuleState());
if (NULL == m_hCodejockMemFont)
{
::EnterCriticalSection(&m_fontAccess);
if (NULL == m_hCodejockMemFont
... 


Back to Top
lviolette View Drop Down
Groupie
Groupie
Avatar

Joined: 17 March 2007
Location: United States
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote lviolette Quote  Post ReplyReply Direct Link To This Post Posted: 18 September 2017 at 7:54pm
I can confirm that adding AFX_MANAGE_STATE has fixed the issue for us.
L. Violette
Monolith
www.lith.com
Xtreme Toolkit Pro v22.1.0
Back to Top
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Post Options Post Options   Thanks (1) Thanks(1)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 01 October 2017 at 9:16am
Hello Recomatics,

Your solution was introduced in CXTPPrimitiveDrawer::InitFont().

Thank you.

Regards,
 Oleksandr Lebed
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.203 seconds.