?
Solved

Embed an external EXE in Delphi App

Posted on 2000-05-13
4
Medium Priority
?
367 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 300 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month12 days, 1 hour left to enroll

752 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