Including a file in the EXE file

Posted on 1998-11-07
Last Modified: 2013-11-18

I'm trying to write a program to hook the keyboard. However I understood that I must use a DLL file in order to do so.

How can I do that when my main EXE file is running it will create the dll (For example: I need some way to save the DLL data inside the EXE file and to write it to a new .dll file in runtime)
Question by:urih

Expert Comment

ID: 1346027
Is it going to be a freeware version?

May I have a copy of it?

LVL 10

Accepted Solution

viktornet earned 100 total points
ID: 1346028
Here is an article I found some time ago...
Put Anything In Your Delphi EXE!

by William A. Portillo -

I don't know if this is useful stuff but after a couple of weeks of playing with the
resources side of Delphi, I ended up writing a routine that will &quotextract" other
files out of a Delphi EXE. I found this useful for distributing little picture or sound files
with the application or as a setup program with internal files. No doubt many of you
will find other uses for this technique.

First, I create an RC project with NOTEPAD.EXE and ARJ.EXE in it as follows (we'll
call it RESJUNK.RC):


then I compile it with BRCC32 into a RES file. After this I include it in my Delphi
project by using the $R compiler directive like this:


and extract this files by using the TResourceStream class.

        procedure ExtractRes(ResType, ResName, ResNewName : String);
           Res : TResourceStream;
           Res := TResourceStream.Create(Hinstance, Resname, Pchar(ResType));

I hope this proves to be relevant to someone at least. If you want to share ideas on
this, please email me. If you mail me back, please put "WP:" on the subject line.
This lets my boss know that the mail is for me.

Expert Comment

ID: 1346029
You the man Vik.
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 10

Expert Comment

ID: 1346030

Author Comment

ID: 1346031
10x !!

It works great !! :))))
LVL 10

Expert Comment

ID: 1346032

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Suggested Solutions

Title # Comments Views Activity
error 1.1 400 Bad request idhttp delphi 18 202
how to change, disabled button color FMX ? 1 49
MS Access from Delphi 31 80
Way to create an iPhone app for my customers 8 43
Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
Shoutout to Emily Plummer ( for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

756 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