Solved

How can I run enother exe app

Posted on 1998-06-14
7
216 Views
Last Modified: 2010-04-04
I nead to run another application from my exe
program.
I tryed to use ExecuteFile and ShellExecute,
however delphi(3) replays with "Undeclared identifier"

0
Comment
Question by:mAmitai
7 Comments
 
LVL 2

Expert Comment

by:rene100
ID: 1352648
can you please give us the code you use?

rene100
0
 
LVL 1

Author Comment

by:mAmitai
ID: 1352649
ExecuteFile('DINAMIC.EXE', '', 'C:\EPC\', SW_SHOW);
the syntax is streit from delphi's lousy help.
Any way, eny other method will do.
0
 
LVL 3

Accepted Solution

by:
Matvey earned 50 total points
ID: 1352650
To use that procedure you have to include the unit that contains it. Look in the lousy help for the unit name...

But for executing exe's you better use a much more functional components. I'll send you one if you post email.

Regards,
Matvey
0
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 
LVL 5

Expert Comment

by:inter
ID: 1352651
Hi friends,

Matvey, you are faster than me. Use the following (PLEASE GIVE POINTS TO MATVEY I think he has the similiar code)...

I do not know the API ExecuteFile. However win32 helps said that to run a program from Win32 we'd better use CreateProcess. It has several parameters and looks complicated. May be you can make use of the following code:


 { returns -1 if the Exec failed }
 function WinExec32(FileName:String; Visibility : integer):integer;
 var
   zAppName:array[0..512] of char;
   zCurDir:array[0..255] of char;
   WorkDir:String;
   StartupInfo:TStartupInfo;
   ProcessInfo:TProcessInformation;
 begin
   StrPCopy(zAppName,FileName);
   GetDir(0,WorkDir);
   StrPCopy(zCurDir,WorkDir);
   FillChar(StartupInfo,Sizeof(StartupInfo),#0);
   StartupInfo.cb := Sizeof(StartupInfo);
   StartupInfo.dwFlags := STARTF_USESHOWWINDOW;
   StartupInfo.wShowWindow := Visibility;
   if not CreateProcess(nil,
     zAppName,                      { pointer to command line string }
     nil,                           { pointer to process security attributes }
     nil,                           { pointer to thread security attributes }
     false,                         { handle inheritance flag }
     CREATE_NEW_CONSOLE or          { creation flags }
     NORMAL_PRIORITY_CLASS,
     nil,                           { pointer to new environment block }
     nil,                           { pointer to current directory name }
     StartupInfo,                   { pointer to STARTUPINFO }
     ProcessInfo) then              { pointer to PROCESS_INF }
      Result := -1
 end;

Just call it as WinExec32('DINAMIC.EXE', SW_SHOW');
if you still got the error it absolutely means that SW_SHOW is not declared. So include Windows.pas in your USES clause.
Regards, Igor
0
 
LVL 1

Author Comment

by:mAmitai
ID: 1352652
I used "inter" answer, so he shuld get the points.
In VB and the good old C, it is so simple...
Borland shuld realy improve there help.

   THanks Guys...


0
 
LVL 3

Expert Comment

by:Matvey
ID: 1352653
So you don't want the component? Weired! It's very useful and has lot's of functions.

Propably Igors code...

PS Igor, you're awake on the weekend - how about talking friend?
0
 
LVL 1

Author Comment

by:mAmitai
ID: 1352654
I wold love to have the component!
EMAIL:amitai@plasson.co.il
I Used wat's close to the eye and working...

   Amitai

0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

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…
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

803 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