Solved

How to execute other application in delphi3

Posted on 1998-10-12
3
156 Views
Last Modified: 2010-04-06
Can you tell me about how to execute other application in
delphi 3
0
Comment
Question by:tanad
3 Comments
 
LVL 3

Accepted Solution

by:
philipleighs earned 50 total points
ID: 1342612
Hi,

WinExec(PathName, SW_SHOW)

or

ShellExecute(...

I may have the parameters wrong so check in Delphi help

Cheers,
Phil.

0
 
LVL 10

Expert Comment

by:viktornet
ID: 1342613
Example for ShellExecute() would be

ShellExecute(0, 'open', PathName, nil, nil, SW_SHOWNORMAL);//Take a look at the parameters because I same as Phil am not sure if I haven't missed maybe one parameter :->

Regards,
Viktor Ivanov
0
 
LVL 1

Expert Comment

by:BlackDeath
ID: 1342614
and in addition i want to state:

if you put uses fmxutils in your header you can access the function ExecuteFile from delphi. this one "encapsulates" ShellExecute from the win api.

function ExecuteFile(const FileName, Params, DefaultDir: string; ShowCmd: Integer): THandle;

an example for a call:

const
  sCmdPar = '-a -&f -ex -P a:\pizzadb.zip';

procedure TForm1.SpeedButton2Click(Sender: TObject);
var
  sDataPath: string;
begin
  if not DirectoryExists(Edit1.Text) then begin
    MessageDlg('Directory ''' + Edit1.Text + ''' does not exist',
      mtError, [mbOk], 0);
    ActiveControl := Edit1;
    Exit;
  end;
  sDataPath := Edit1.Text;
  if Copy(sDataPath, Length(sDataPath), 1) <> '\' then
    sDataPath := sDataPath + '\';
  if MessageDlg('Insert a disk in drive A: and press RETURN.:', mtInformation, [mbOk, mbCancel], 0) = mrCancel then
    Exit;
  if not DirectoryExists('A:\') then begin
    MessageDlg('no disk present in drive A:', mtError, [mbOk], 0);
    Exit;
  end;
  ExecuteFile('PKZIP.EXE', sCmdPar + ' ' + sDataPath + '*.*', ExtractFilePath(Application.ExeName), SW_SHOWNORMAL);
end;

with this function you ain't got full control of the process and it's threads regarding security, environment, priority etc. but i think that was not what you've got in mind anyway.

if this one shouldn't be sufficient, tell us.

regs,

Black Death.

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

Title # Comments Views Activity
PDF library for Delphi 2 104
Path  to current project in Delphi. 2 72
Internet Explorer View Settings Question 15 106
error 1.1 400 Bad request idhttp delphi 18 54
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

910 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

19 Experts available now in Live!

Get 1:1 Help Now