Solved

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

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

Database Solutions Engineer FAQs

In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller single-server environments.

Question has a verified solution.

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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

623 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