Solved

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

Posted on 2003-11-18
7
266 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
  • 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

706 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now