Solved

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

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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
has77  challenge 9 83
wait notify demo infinite loop 3 110
modThree challenge 4 90
wordmultiple challenge 12 131
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…
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…
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.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

776 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