Q: How do I get the right resource in language-dll
Klaus Kurzawa -- klausk@saruman.cadpoint.se
Wednesday, December 04, 1996
Hi,
Environment: VC++ 4.1, Win 95, NT 4.0, NT 3.51
I tried the msnews with no luck.
In my app I load a dll that contains resources of the language the user runs in
and use AfxSetResourceHandle(hRes) to use it.
Then I took the dirpkr-sample to use a dir-selector, my app needs to run on
NT3.51 & NT4 & Win95, and there You should assign the dialog-template to use as
Your dialog:
cfdlg.m_ofn.lpTemplateName = MAKEINTRESOURCE(IDD_DLG_SELDIR);
Now this don't work for me because this only loads the resource from the
exe-file.
So I tried to find the resource in the dll like this:
HINSTANCE hInst = AfxFindResourceHandle(MAKEINTRESOURCE(IDD_DLG_SELDIR),
RT_DIALOG);
I tried this one to with no success
//HINSTANCE hInst = AfxGetResourceHandle();
HRSRC hRes = ::FindResource( hInst,
MAKEINTRESOURCE(IDD_DLG_SELDIR), RT_DIALOG);
HGLOBAL hGlobal = ::LoadResource(hInst, hRes);
I think this line is the error, how do I get the template from the HGLOBAL or
how should I solve this at all?
cfdlg.m_ofn.lpTemplateName = MAKEINTRESOURCE(hGlobal);
The dialog are not displayed
cfdlg.DoModal();
Hopefully someone on this list can help me?
Best regards,
Klaus Kurzawa
/klausk@cadpoint.se
Klaus Kurzawa -- klausk@saruman.cadpoint.se
Thursday, December 05, 1996
[Mini-digest: 2 responses]
---------------------------- Forwarded with Changes ---------------------------
From: Klaus Kurzawa at CADPOINT.SWE
Date: 12/4/96 9:10AM
*To: mfc-l@netcom.com at SMTPLINK
Subject: Q: How do I get the right resource in language-dll
-------------------------------------------------------------------------------
Hi,
Environment: VC++ 4.1, Win 95, NT 4.0, NT 3.51
In my app I load a dll that contains resources of the language the user runs in
and I call AfxSetResourceHandle(hRes) to make it the current resource.
Then I took the dirpkr-sample to use a dir-selector, my app needs to run on
NT3.51 & NT4 & Win95, and in that sample You should assign the dialog-template
to use as Your dialog:
cfdlg.m_ofn.lpTemplateName = MAKEINTRESOURCE(IDD_DLG_SELDIR);
Now this don't work for me because this only loads the resource from the
exe-file.
So I tried to find the resource in the dll like this:
HINSTANCE hInst = AfxFindResourceHandle(MAKEINTRESOURCE(IDD_DLG_SELDIR),
RT_DIALOG);
I tried this one too with no success
//HINSTANCE hInst = AfxGetResourceHandle();
HRSRC hRes = ::FindResource( hInst,
MAKEINTRESOURCE(IDD_DLG_SELDIR), RT_DIALOG);
HGLOBAL hGlobal = ::LoadResource(hInst, hRes);
Here's my problem, how do I get the template from the HGLOBAL or how should I
solve this in another way?
cfdlg.m_ofn.lpTemplateName = MAKEINTRESOURCE(hGlobal);
The dialog are not displayed
cfdlg.DoModal();
Best regards,
Klaus Kurzawa
/klausk@cadpoint.se
-----From: David Lowndes
>In my app I load a dll that contains resources of the language the user runs
in
and use AfxSetResourceHandle(hRes) to use it.
Then I took the dirpkr-sample to use a dir-selector, my app needs to run
on
NT3.51 & NT4 & Win95, and there You should assign the dialog-template to
use as
Your dialog:....
cfdlg.m_ofn.lpTemplateName = MAKEINTRESOURCE(IDD_DLG_SELDIR);
<
Klaus,
I replied to your note in the newsgroup but for some reason my messages
aren't appearing at the moment.
line above
is to set the cfdlg.m_ofn.hInstance to the instance handle of your
loaded
DLL (the handle returned by LoadLibrary).
>Dave
| Вернуться в корень Архива
|