Solved

How to execute other application in delphi3

Posted on 1998-10-12
3
160 Views
Last Modified: 2010-04-06
Can you tell me about how to execute other application in
delphi 3
0
Comment
Question by:tanad
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

739 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