Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.