Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » loading toolbar from a dll Collapse All
Subject Author Date
Chris Anderson Feb 11, 2009 - 5:17 PM

our app tries to create a toolbar based on templates defined in a dll, when it calls



g_CmdManager->UpdateFromToolBar(...)


UpdateFromToolBar fails as it doesn’t know inside which module it should look for the resource. Is there any way to let command manager or resource manager know inside which module it should search for the resource ?


Thanks


Technical Support Feb 13, 2009 - 3:01 AM

Yes, there is a solution, but it’s related to Prof-UIS toolbars (CExtToolControlBar) and for other Prof-UIS components only. All the Prof-UIS classes are loading resources using the Prof-UIS resource manager component (the CExtResourceManager class and the g_ResourceManager global smart pointer variable). By default, resource manager searches the queried resources using exactly the same algorithm which is coded inside MFC. The first extended feature of the resource manager is the preferred language identifier for loading resources. You can turn on the preferred language identifier for searching available resources using the g_ResourceManager->AllowCustomLang(true); code and then you can specify the desired language identifier using the g_ResourceManager->SetLangIdDesired( __EXT_MFC_LANG_ID_*** ) code. All the supported by Prof-UIS __EXT_MFC_LANG_ID_*** language identifiers are defined in the …/Prof-UIS/Include/ExtCmdManager.h file. After these two invocations, the resource manager will use the resource searching algorithm similar to MFC’s but it will search resources of desired language first, and then, on the second step, it will search resources like MFC does. The third feature of the resource manager, and the most interesting feature for you, is the list of HINSTANCE handles of DLL modules which will be used for searching resources before all the described above details will be applied in the resource searching algorithm. The set of the CExtResourceManager::RscInst_***() methods is related to this feature. You should use the g_ResourceManager->RscInst_Insert( hInstance, bFreeInstance ) code for adding your DLL into resource searching algorithm of the resource manager. The hInstance parameter is the DLL module handle. The bFreeInstance parameter is the flag which indicates whether the resource manager should invoke the ::FreeLibrary( hInstance ); code at shutdown. The handle of the DLL module specified in the invocation of the CExtResourceManager::RscInst_Insert() method can the module handle of any kind of DLL. It can be pure resource DLL, it can be DLL with run-able code which is used or un-used by code of your application, it even can be the module handle of EXE file which was loaded as resource searching target using the ::LoadLibrary() Win32 API.

Technical Support Feb 12, 2009 - 12:02 PM

If your DLL modules are MFC extension DLLs and they are loaded using AfxLoadLibrary() API, then their resources will be found successfully.

Chris Anderson Feb 12, 2009 - 3:24 PM

unfortunately the dll is not a MFC extension, and probably we are not going to change it. any solution ?


thanks