Print Page | Close Window

How to use resource dll in XTToolkitPro?

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=9691
Printed Date: 10 June 2024 at 9:02am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How to use resource dll in XTToolkitPro?
Posted By: minhduc031
Subject: How to use resource dll in XTToolkitPro?
Date Posted: 25 February 2008 at 6:21am
Dear all,
I have a problem with using resource dll to develop application by XTToolkitPro. I'm using:

XTPResourceManager()->SetResourceManager(new CXTPResourceManager());
XTPResourceManager()->SetResourceFile(_T("Resource.dll"));

but it is't working. I have some dialogs need to load from resource dll.

Please tell me for valid method.

Thanks for your attention.



Replies:
Posted By: Oleg
Date Posted: 25 February 2008 at 2:03pm
it requares to switch Toolkit resources. for your own resources use AfxSetResourceHandle.

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


Posted By: Alro
Date Posted: 26 February 2008 at 2:42am
Use it :

    HINSTANCE m_Old    = AfxGetResourceHandle();
    AfxSetResourceHandle( ::GetModuleHandle("Ressource.dll") );

// TODO your code
// TODO your code

    AfxSetResourceHandle( m_Old );



Posted By: minhduc031
Date Posted: 26 February 2008 at 4:11am
Thanks of all,
But I used :

hDll = LoadLibrary("Ressource.dll");
AfxSetResourceHandle(hDll);

-> App crashed !!!
My app using doc/view structure , and when i traced bug, i found out bug because of: CSplitterWnd::CreateView(...) , more deeply :

BOOL CWnd::CreateDlg(LPCTSTR lpszTemplateName, CWnd* pParentWnd)
{
    // load resource
    LPCDLGTEMPLATE lpDialogTemplate = NULL;
    HGLOBAL hDialogTemplate = NULL;
    HINSTANCE hInst = AfxFindResourceHandle(lpszTemplateName, RT_DIALOG);
    HRSRC hResource = ::FindResource(hInst, lpszTemplateName, RT_DIALOG);
    hDialogTemplate = LoadResource(hInst, hResource);
    if (hDialogTemplate != NULL)
        lpDialogTemplate = (LPCDLGTEMPLATE)LockResource(hDialogTemplate);
    ASSERT(lpDialogTemplate != NULL);

    // create a modeless dialog
    BOOL bSuccess = CreateDlgIndirect(lpDialogTemplate, pParentWnd, hInst);
.
.
.
}

--->>>>bSuccess = FALSE.

What's matter with my splitter create view?



Posted By: Oleg
Date Posted: 26 February 2008 at 4:38am
Hi,
You don't have some dialog resource in your dll.


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


Posted By: minhduc031
Date Posted: 26 February 2008 at 5:41am
Hi Oleg,

Actually, my app is kind of multilanguages app using resource dlls. The solution which i choiced is using multi resource dll. So, i load a resource for each change language.

With call dialog, it's no problem. But when i created splitter ctrl , crash happen !!!

I checked resource dll, there is nothing to miss. Do you have another idea?


Posted By: Oleg
Date Posted: 26 February 2008 at 3:18pm
 
It can only be missing resource problem. Double check you have all CFrameView dialogs in resources.


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


Posted By: minhduc031
Date Posted: 27 February 2008 at 2:54am
Oh! Dear Oleg,
Believe me, there is nothing to miss in the resource.I'm using UNICODE in it. So, is there any notes with this circumstance?


Posted By: Oleg
Date Posted: 27 February 2008 at 5:27am
Hi,
Another option if you use some custom control (not one from User32 or ComCtrl32) in this dialog. If so, need register it for this Instance.


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


Posted By: minhduc031
Date Posted: 28 February 2008 at 1:05am
Hi Oleg,
Thanks for your support.
It worked when i registered it.

I will call you as "Oleg Salenko" - a Top Football Player in Russian Team at Mondial USA 1994.



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