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.
DLSAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.