Solved

Load bitmap from RES, DLL or EXE

Posted on 2004-08-10
2
435 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
Comment Utility
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
Comment Utility
there is also a nice article about embedding resources into executables at:

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

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
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…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

743 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