Execute .exes from Delphi apps - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Execute .exes from Delphi apps

Is there anyone who knows how to run other programs

(or execute Dos-commands) from within a Delphi

application?


And, I wonder if there's some way to stop the execution

of a program for an interval och msecs.


I'd be glad to get an answer to one of these, I've

been looking for it quite a while.


-Patrik-


Comments

  • : Is there anyone who knows how to run other programs

    : (or execute Dos-commands) from within a Delphi

    : application?


    : And, I wonder if there's some way to stop the execution

    : of a program for an interval och msecs.


    : I'd be glad to get an answer to one of these, I've

    : been looking for it quite a while.


    : -Patrik-


    Use WinExec to run exes.




  • : Is there anyone who knows how to run other programs

    : (or execute Dos-commands) from within a Delphi

    : application?


    : -Patrik-


    I use the fileexecute function cribed from the

    Delphi3 demo programs.


    demosdocfilemanexfmxwin.pas


    basically you add shellapi to your uses statement and

    then uses the function.




    The fragment below shows the function and how to run

    the program calc.exe from your delphi app.


    uses shellapi;


    function tformMain.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, strPCcopy(zfilename, filename),

    strPCopy(zParams,Params);

    strPCopy(zDir,DefaultDir),showCmd);

    end;


    procedure tFormMain.runcalc;

    begin

    executefile('calc.exe','','',SW_Show);

    end;





Sign In or Register to comment.