Solved

Dos-app.safe?

Posted on 1997-05-22
4
199 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

Suggested Solutions

Title # Comments Views Activity
Best Firemonkey component pack 1 119
Delphi cmd execution 6 67
Internet Explorer View Settings Question 15 116
enhance the following code 3 37
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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

809 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