Solved

How to execute other application in delphi3

Posted on 1998-10-12
3
161 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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

691 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