Board index » delphi » Launching an external exe program

Launching an external exe program

Hi,

In Turbo Pascal 7, the function "exec()" allowed the programmer to
launch an external exe program.  Is this possible in Delphi?  If so how?

The reason is I need to run a Sync program that sends my database
through the serial port.  I wanted my program to have a button that will

launch the program instead of the user having to go through the Start
menu.

Any help would be appreciated,

Ryan

 

Re:Launching an external exe program


I use a function called execute file which has the form

ExecuteFile(aaaaaaa,bbbbbb,'',sw_ShowNormal) ;
        where aaaaa is the file to be run
                    bbbbb are any parameters

i.e.  ExecuteFile('c:\Program Files\Microsoft
Office\Office\winword.exe,'','',sw_showNormal);
In a separate Utilities unit (because I call this function from a number of
places) I have the following :-

function ExecuteFile(const FileName, Params, DefaultDir: string; ShowCmd:
Integer): THandle;
var
       zFileName, zParams, zDir: array[0..79] of Char;
begin
    Result := ShellExecute(Application.MainForm.Handle, nil,
                      StrPCopy(zFileName, FileName), StrPCopy(zParams,
Params),
                                StrPCopy(zDir, DefaultDir), ShowCmd);
end;

hope this is of some use

Philip Jackson

Ryan D. Kerr <gory...@home.com> wrote in message
news:38D6AB35.FD981CF4@home.com...

Quote
> Hi,

> In Turbo Pascal 7, the function "exec()" allowed the programmer to
> launch an external exe program.  Is this possible in Delphi?  If so how?

> The reason is I need to run a Sync program that sends my database
> through the serial port.  I wanted my program to have a button that will

> launch the program instead of the user having to go through the Start
> menu.

> Any help would be appreciated,

> Ryan

Re:Launching an external exe program


You can use WinAPI function CreateProcess to launch another executable.
Refer to MS SDK for more information.

Ping

Ryan D. Kerr <gory...@home.com> wrote in message
news:38D6AB35.FD981CF4@home.com...

Quote
> Hi,

> In Turbo Pascal 7, the function "exec()" allowed the programmer to
> launch an external exe program.  Is this possible in Delphi?  If so how?

> The reason is I need to run a Sync program that sends my database
> through the serial port.  I wanted my program to have a button that will

> launch the program instead of the user having to go through the Start
> menu.

> Any help would be appreciated,

> Ryan

Re:Launching an external exe program


Try http://www.q3.nu/trucomania/
for many tips, including your problem.

Regards, Henk van Heun

Other Threads