Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - How to use resource dll in XTToolkitPro?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to use resource dll in XTToolkitPro?

 Post Reply Post Reply
Author
Message
minhduc031 View Drop Down
Newbie
Newbie
Avatar

Joined: 25 February 2008
Location: Vietnam
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote minhduc031 Quote  Post ReplyReply Direct Link To This Post Topic: How to use resource dll in XTToolkitPro?
    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.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Alro View Drop Down
Newbie
Newbie
Avatar

Joined: 13 February 2008
Location: France
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote Alro Quote  Post ReplyReply Direct Link To This Post 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 );

Back to Top
minhduc031 View Drop Down
Newbie
Newbie
Avatar

Joined: 25 February 2008
Location: Vietnam
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote minhduc031 Quote  Post ReplyReply Direct Link To This Post 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?

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 26 February 2008 at 4:38am
Hi,
You don't have some dialog resource in your dll.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
minhduc031 View Drop Down
Newbie
Newbie
Avatar

Joined: 25 February 2008
Location: Vietnam
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote minhduc031 Quote  Post ReplyReply Direct Link To This Post 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?
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
minhduc031 View Drop Down
Newbie
Newbie
Avatar

Joined: 25 February 2008
Location: Vietnam
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote minhduc031 Quote  Post ReplyReply Direct Link To This Post 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?
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
minhduc031 View Drop Down
Newbie
Newbie
Avatar

Joined: 25 February 2008
Location: Vietnam
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote minhduc031 Quote  Post ReplyReply Direct Link To This Post 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.
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.105 seconds.