• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 242
  • Last Modified:

How can I run enother exe app

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
mAmitai
Asked:
mAmitai
1 Solution
 
rene100Commented:
can you please give us the code you use?

rene100
0
 
mAmitaiAuthor Commented:
ExecuteFile('DINAMIC.EXE', '', 'C:\EPC\', SW_SHOW);
the syntax is streit from delphi's lousy help.
Any way, eny other method will do.
0
 
MatveyCommented:
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
interCommented:
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
 
mAmitaiAuthor Commented:
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
 
MatveyCommented:
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
 
mAmitaiAuthor Commented:
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now