Solved

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

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Creating Labels and Frequency list style reports in SAS code 9 130
dog bark java program 15 132
sum13 challenge 24 149
mapBully challenge 6 200
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

751 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