Solved

Dos-app.safe?

Posted on 1997-05-22
4
195 Views
Last Modified: 2010-04-04
How do I run an Dos-application safely (without any problems with memory, collision etc.)from my self-developed Delphi-application? I have tried to do it with the Winexec-command (WinExec('c:\test\test.exe' ,SW_maximize);), however it does not work properly all the times, only sometimes (Depending on ...?). Please give me a syntax example...
Thanks!!  Erik N
PS. I run Delphi Developer R2....
PS2. I do not understand the syntax of Createprocess,(I need a syntax example)...
0
Comment
Question by:Erik N
  • 2
4 Comments
 
LVL 4

Expert Comment

by:erajoj
ID: 1336542
Delphi version?
Have you looked at createprocess?
0
 

Author Comment

by:Erik N
ID: 1336543
Edited text of question
0
 

Author Comment

by:Erik N
ID: 1336544
Edited text of question
0
 
LVL 1

Accepted Solution

by:
sleach earned 100 total points
ID: 1336545
Here is an example of CreateProcess.  I have tested it, and it works fine Running Dos applications.

Hope this helps.

procedure TForm1.Button1Click(Sender: TObject);
VAR
TPI : TProcessInformation;
TSI : TStartupInfo;
begin
if OpenDialog1.execute then
  begin
  FillChar(TSI, SizeOf(TSI), 0);
  TSI.CB := SizeOf(TSI);
  CreateProcess(PChar(OpenDialog1.FileName), NIL, NIL, NIL, False,
    DETACHED_PROCESS OR NORMAL_PRIORITY_CLASS, NIL, NIL,
    TSI, TPI);
  end;

end;

0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now