Adding Resources to an EXE

Question:

How can I add resources to an EXE or DLL? I am using Delphi 3 at the moment. For example, I want to use a new Cursor (a self created 32×32 bitmap), but I need to add it first to the resources of the application before I can use the LoadCursor command. All of the examples show you how to read existing resources and not how to add resources.

Also, how can I use a bitmap safely in an application without sending the bitmap with the application (Using LoadFromFile)? I want to make it impossible to change the bitmap after the application is compiled.

Answer:

First off, you need to create a resource file. Since it’s just a cursor, then all you need to do is create it with the Image Editor and save the file as a RES file. It’s best to save the file to the same directory as your project file. Once you’ve done that, in the main unit of your application, you just need to declare a compiler directive in the implementation section of your unit to include the resource file. Here’s an example:

implementation{$R *.DFM} //This is the default for the form{$R MyCursor.RES} //Include this as well

That’s all there is to it.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

The Latest

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a

chrome os developer mode

How to Turn on Chrome OS Developer Mode

Google’s Chrome OS is a popular operating system that is widely used on Chromebooks and other devices. While it is designed to be simple and user-friendly, there are times when users may want to access additional features and functionality. One way to do this is by turning on Chrome OS

homes in the real estate industry

Exploring the Latest Tech Trends Impacting the Real Estate Industry

The real estate industry is changing thanks to the newest technological advancements. These new developments — from blockchain and AI to virtual reality and 3D printing — are poised to change how we buy and sell homes. Real estate brokers, buyers, sellers, wholesale real estate professionals, fix and flippers, and beyond may