Link to home
Start Free TrialLog in
Avatar of terrys398
terrys398

asked on

Loading a Dialog Resource from a separate DLL

I've browsed through many of the similar questions, and none seem to address this issue, so here it goes...

I'm trying to do the usual Internationalization task of separating the GUI resources from the code.  I've compiled the resources into a separate DLL from the code that runs the GUI.  (Note: I'm using MFC on Windows CE)

Typically, if the resources weren't in a different file, the code would look like this:

MyDialog pDlg;
pDlg.DoModal();

Since my code for MyDialog is in a different DLL, I've attempted the following, which must be incorrect since it doesn't work:

g_hresource = LoadLibrary (TEXT("resourceDLL.dll"));

HGLOBAL hGlbl = LoadResource(g_hresource,FindResource(g_hresource, (const unsigned short *) IDD_MYDIALOG, RT_DIALOG));

LockResource(hGlbl);

MyDialog pDlg;

pDlg.InitModalIndirect(hGlbl);

pDlg.DoModal();

Now, any ideas on how to do this correctly?
ASKER CERTIFIED SOLUTION
Avatar of BeyondWu
BeyondWu
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial