Solved

Load bitmap from RES, DLL or EXE

Posted on 2004-08-10
2
440 Views
Last Modified: 2010-04-05
Hi, I need to load bitmaps from resourcefile (PRGImages.res)?
After loading the bitmap it must be assigned to SpeedButton1.Glyph.

Or what is the fastest and good way to set this up?
       1. add bmp's to a RES?
       2. add bmp's to the EXE?
       3. add bmp's to a DLL?

The RES-file (option 1) I already have (PRGImages.res with 3 bmp 16x16).
Options 2 and 3 should also include the way to add the bmp's into the EXE or DLL.

I would prefer some code (f.e. project).

Thanks a lot for your help. Stef
0
Comment
Question by:Delphiwizard
  • 2
2 Comments
 
LVL 4

Accepted Solution

by:
alikoank earned 500 total points
ID: 11760557
you can embed your resource files into executables by {$R} directive put it under the same directive for your forms.

{$R *.DFM}
{$R MyResourceFile.res}

if you have a bitmap in your resource file you can assign this bitmap to an image like this

Image1.Picture.Bitmap.Handle := LoadBitmap(hInstance, 'my_bitmap_id');
0
 
LVL 4

Expert Comment

by:alikoank
ID: 11760584
there is also a nice article about embedding resources into executables at:

http://www.howtodothings.com/showarticle.asp?article=288
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

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