0

i want to import exe file into my delphi application resources.
and then extract and run the exe.

my qustion is:
how can i:
Import exe file into my resources
Extract exe file into "c:\" (with SaveToFile function)
Run (Shell exeFilePath) the exe.

Arioch 'The
  • 15,799
  • 35
  • 62
sthml
  • 47
  • 2
  • 7
  • 3 questions in one? Since when was that allowed? Each of these is its own question, each of which has been asked/answered many times, and there's plenty of resources out there about it. 1: "How do I embed an EXE file inside my application?"; 2: "How do I extract an embedded EXE resource from my application?"; 3: "How do I execute another program from my application?" – Jerry Dodge Feb 04 '13 at 05:03

2 Answers2

2

See this answer for an example how to include an file as a resource to your app. The example there is for a text file but it is the same idea for the exe file. It also shows you how to load that resource into an TResourceStream and then you just use it's SaveToFile method to save the exe to the disc. Once you have the exe on the disc you can run it with ie CreateProcess.

Community
  • 1
  • 1
ain
  • 22,394
  • 3
  • 54
  • 74
0

there are component libraries allow you tou store your file on the from, inside DFMs

For example if installed JediVCL you can drop the TJvDataEmbedded component onto the TDataModule or TForm and load a file into it. Then in the runtime you can extract that file onto disk or into TMemoryStream.


About running - the most simple thing would be to call ShellExecute function - read your Delphi help about it. Or you can use the class from Jedi CodeLib which allow you a lot of customizations. But you probably do not need it.

Arioch 'The
  • 15,799
  • 35
  • 62