Solved

How can I run enother exe app

Posted on 1998-06-14
7
210 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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

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…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

757 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

20 Experts available now in Live!

Get 1:1 Help Now