Solved

Including a file in the EXE file

Posted on 1998-11-07
6
162 Views
Last Modified: 2013-11-18
Hi

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)
0
Comment
Question by:urih
6 Comments
 
LVL 4

Expert Comment

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

May I have a copy of it?

saar@bigfoot.com


0
 
LVL 10

Accepted Solution

by:
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 - hallcom@wantree.com.au

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):

 NOTEPAD EXEFILE C:\WINDOWS\NOTEPAD.EXE
 ARJ EXEFILE C:\UTILS\ARJ.EXE

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:

{$R RESJUNK.RES}

and extract this files by using the TResourceStream class.

        procedure ExtractRes(ResType, ResName, ResNewName : String);
         var
           Res : TResourceStream;
         begin
           Res := TResourceStream.Create(Hinstance, Resname, Pchar(ResType));
           Res.SavetoFile(ResNewName);
           Res.Free;
         end;

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.
------------------------
Cheers,
Viktor
0
 
LVL 5

Expert Comment

by:scrapdog
ID: 1346029
You the man Vik.
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 10

Expert Comment

by:viktornet
ID: 1346030
Y?
0
 

Author Comment

by:urih
ID: 1346031
10x !!

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

Expert Comment

by:viktornet
ID: 1346032
:)
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
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…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

786 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