Solved

How can I run enother exe app

Posted on 1998-06-14
7
213 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

895 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

14 Experts available now in Live!

Get 1:1 Help Now