Solved

Load bitmap from RES, DLL or EXE

Posted on 2004-08-10
2
445 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
[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
  • 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying 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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…

688 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