Solved

Load bmp from resource dll rather than exe's own resource.

Posted on 2003-11-18
7
313 Views
Last Modified: 2013-11-20
I have an dialog based exe with some bitmap buttons. Now I have created a resource dll with another set of bmp for buttons. How do I load bmp's for button from resource dll? Please help me.
0
Comment
Question by:muftiscrop
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
7 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 63 total points
ID: 9772874
You'd use

HINSTANCE hResDll = LoadLibrary ( "myresource.dll");
HINSTANCE hResOld = AfxGetResourceHandle ();

AfxSetResourceHandle ( hResDll);

// use the resources from your DLL

AfxSetResourceHandle ( hResOld); // switch back to 'normal'
0
 
LVL 86

Expert Comment

by:jkr
ID: 9772910
BTW, alternatively, you could use the solution described in http://support.microsoft.com/default.aspx?scid=kb;en-us;198846
0
 
LVL 48

Assisted Solution

by:AlexFM
AlexFM earned 62 total points
ID: 9773452
Loading BITMAP from Dll:

HBITMAP hBmp = ::LoadImage(
    hDll,                                   // resource Dll handle
    MAKEINTRESOURCE(id),     // resource ID
    IMAGE_BITMAP,
    0,
    0,
    LR_DEFAULTCOLOR);
0
 
LVL 86

Expert Comment

by:jkr
ID: 11854076
Both solutions will work - I'd say "split"
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question