Print Page | Close Window

(SOLVED) Resource Management EXE <-> Regular DLL

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=23303
Printed Date: 21 December 2024 at 8:32pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: (SOLVED) Resource Management EXE <-> Regular DLL
Posted By: mgampi
Subject: (SOLVED) Resource Management EXE <-> Regular DLL
Date Posted: 03 April 2017 at 7:05am
Hello;

I'm just facing a problem with the toolkit 17.3.0 when used in an application and a regular DLL (using MFC in a shared library in both projects), when both are depending on command bars and the regular DLL is dynamically loaded/unloaded during runtime.

The app and DLL are both using all kinds of commandbar objects, docking panes, ...

When the library is loaded a non modal dialog box is created and displayed. The probleme here is, that the string resources for the DLL based dialog are by mistake loaded from the main app and not from the DLL (partly duplicate IDs). Therefore I tried to call XTPResourceManager()->SetResourceHandle() to set the resource handle to the DLL. When the dialog is closed, the library is unloaded too! That's a customer requirement!

Now, the resource handle of the XTPResourceHandle singleton is still pointing to the DLL and crashes are likely to happen. While the dialog box is shown, the resource instance handle is always pointing to the DLL. I don't know whether this may result in problems within the main app or not?

How can I solve this situation in a correct way? Is there a way to auto switch the resource handle (something like AFX_MANAGE_STATE)?
BTW: Renumbering all DLL resources to be unique for the app and the DLL is not an option, since the DLL is used in several other applications, that we are not responsible for (no code).

BTW: This design almost always result in app crashed when closing the app - due to problems with skinning. But this I already asked in a different thread.


-------------
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022



Replies:
Posted By: sharky72
Date Posted: 11 April 2017 at 5:35am
Look at CXTPResourceManager::CManageState::CManageState()
it may be help.


Posted By: mgampi
Date Posted: 26 April 2017 at 8:38am
Hi;

Just solved it by myself. Got the necessary hints in MSDN example DLLScreenCap.


-------------
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022



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