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

Excuting other application

In C you can execute other program using system() in VB you can use shell to execute other program what about in Delphi?

for example I want to run Winzip in my application how I do that at Delphi.
0
DLS
Asked:
DLS
1 Solution
 
simonetCommented:
There are several ways to do it from a Delphi app:

uses ShellAPI;

ShellExecute(0, 'open', 'Winzip32.exe', nil, nil, SW_SHOW);

Another way:

WinExec('Winzip32.exe', SW_SHOW);

Yet a third method is to use CreateProcess, but it is far more complex than the ones outlined above, although it gives you much more control over the spanned process.

Note: for the above to work, you'll have to provide the correct paht + file name of the executable.

Yours,

Alex
0
 
firepointCommented:
why not try this way;

var
  zAppName:array[0..512] of char;
  zCurDir:array[0..255] of char;
  WorkDir:String;
  StartupInfo:TStartupInfo;
  ProcessInfo:TProcessInformation;

....

CreateProcess(nil,
    zAppName,                      { pointer to command line string }
    nil,                           { pointer to process security attributes }
    nil,                           { pointer to thread security attributes }
    false,                         { handle inheritance flag }
    NORMAL_PRIORITY_CLASS,     { creation flags }

    nil,                           { pointer to new environment block }
    nil,                           { pointer to current directory name }
    StartupInfo,                   { pointer to STARTUPINFO }
    ProcessInfo) then Result := -1 { pointer to PROCESS_INF }
0
 
MotazCommented:
Alex is right, but I think you must mention the full path e.g. 'c:\program files\winzip\winzip32.exe'

Motaz
0
2018 Annual Membership Survey

Here at Experts Exchange, we strive to give members the best experience. Help us improve the site by taking this survey today! (Bonus: Be entered to win a great tech prize for participating!)

 
simonetCommented:
Motaz, please read the last comment I made before writing "Yours".

Alex
0
 
Fatman121898Commented:
DLS,
This question (or similar) was discussed 5-6 days ago.
See Q_10228364 for details.
Question is named:"Launching Wordpad..."

Jo.
0
 
jpussacqCommented:
try TExecFile Component in Delphi SuperPage
0
 
MoondancerCommented:
This question was awarded, but never cleared due to the JSP-500 errors of that time.  It was "stuck" against userID -1 versus the intended expert whom you awarded.  This corrects the problem and the expert will now receive these points; points verified.

Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them.  If you are an EE Pro user, you can also choose Power Search to find all your open questions.

This is the Community Support link, if help is needed, along with the link to All Topics which reflects many TAs recently added.

http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
http://www.experts-exchange.com/jsp/zonesAll.jsp
 
Thank you,
Moondancer
Moderator @ Experts Exchange
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

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