|
-
May 27th, 1999, 01:22 PM
#1
Resources in a DLL
How does one compile the resources used by an MFC exe or MFC DLL so that they are in a DLL? Then how do you load those resources into the exe or DLL?
Thanks
Jim Bassett
-
May 27th, 1999, 03:12 PM
#2
Re: Resources in a DLL
The online MSDN help contains an article called "Create a Resource-Only DLL".
-
May 28th, 1999, 02:53 AM
#3
Re: Resources in a DLL
Just add the resources to the project which is the DLL and then compile the DLL as normal.
Every time you want to load a resource, do the following:
// save current resource handle
HINSTANCE hInstance = AfxGetResourceHandle();
// set resource handle to ourselves (the DLL)
AfxSetResourceHandle(theApp.m_hInstance);
// then display a dialog or...
int rv = dlg->DoModal();
// ...load an image list, or whatever
CImageList ilMyImageList.Create(IDB_IMAGE_LIST_ID, 16, 0, RGB(192, 192, 192));
// finally, reset resource handle to what it was before
AfxSetResourceHandle(hInstance);
theApp is defined by the Wizard for you and looks something like below:
/////////////////////////////////////////////////////////////////////////////
// The one and only CDLLApp object
CDLLApp theApp;
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|