Exe inside res

Is it possible to put an .exe file inside an .res file, and run it from the .res file. If so...HOW????
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


yes you can add any data to an executable's resource. Just add it as RC_DATA. For the second part: You can only run executables which are represented by a physical file. This means you need to store the exe from the resource to a file on the hard disk.

Ciao, Mike
Preferably in the Windows TEMP directory - then delete it after

Lischke : I think that it should be possible to load your
exe directly into the memory and run it from there.
I don't know how to do, but program like upx work like that
I think. No ?
Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

SmillyAuthor Commented:
Hi there,

Thanks for the response, but do you have some source? becouse how do I add the .exe file as RC_DATA, and how do I get it out from the .res file???

Here is the code:

(Assuming the RC.and RES files are built like this)

       Here is my RC file (files.rc):
       FILE1   DATA    "C:\source\test.exe"

       In your main form, include the following:
       {$R Files.res}

       Here is the code to extract it:

         rs: TResourceStream;
         rs := TResourceStream.Create(hInstance, PChar('File1'),
           WinExec('c:\temp\Test.exe', sw_show);    

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SmillyAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.