Solved

Embed an external EXE in Delphi App

Posted on 2000-05-13
4
366 Views
Last Modified: 2010-04-04
This may be something simple, but I haven't been around Delphi for a while.  In fact, I am using version 3 because I bought that version a few years ago and now I am being asked to create a simple app.

My question is ...  can I embed a stand-alone EXE app into my Delphi EXE.  I would like to do this so that a user would have to launch my EXE and would not be able to browse to the other one to launch that one.

Thanks.
0
Comment
Question by:a_d_m_i_n
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 17

Accepted Solution

by:
inthe earned 100 total points
ID: 2807269
hi,
you can add them to your resource file then extract them from there
example:


make a .rc file (in notepad etc ) that looks like:

 TESTFILE1  EXEFILE C:\TEST1.EXE
 TESTFILE2  EXEFILE C:\TEST2.EXE

and save as myres.rc.
compile with brcc32 to get myres.res

then in unit do:

{$R *.DFM}
{$R MYRES.RES}
procedure ExtractRes(ResType, ResName, ResNewName : String);
var
  Res : TResourceStream;
begin
  Res := TResourceStream.Create(Hinstance, Resname, Pchar(ResType));
  Res.SavetoFile(ResNewName);
  Res.Free;
end;


on form activate or button click
you could show a memo or somethng with the files names and extract them etc..

procedure TForm1.Button1Click(Sender: TObject);
begin
ExtractRes('EXEFILE','TESTFILE1','C:\TEST1_EXE_FROM_RES.EXE');
ExtractRes('EXEFILE','TESTFILE2','C:\TEST2_EXE_FROM_RES.EXE');

end;


Regards Barry
0
 
LVL 17

Expert Comment

by:inthe
ID: 2807272
you can then use shellexecute etc (from shellapi.pas) or winexec(filename,sw_normal)to start the files and when finished can use deletefile(filename) to delete it..
0
 
LVL 17

Expert Comment

by:inthe
ID: 2813812
..tested it yet ?
0
 

Author Comment

by:a_d_m_i_n
ID: 2821259
Yeah.

Sorry for the delay.  I have been trying to tweak it a bit.  Your suggestion is a good one.

Thanks!
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

724 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