Wednesday, March 2, 2011

Find out where your program is running from

Sometimes it's necessary to find out the path to the executable file of your program, in order to find out where to get the rest of the files from. In most cases, the current directory would be the directory where your programs are executed from, but this method would not work if your program path is listed in the PATH or if an user executes your program from another directory.

Here's how to get the directory where your programs is located:
    'program path =  ' +
    ExtractFilePath( Application.ExeName )
    , mtInformation, [mbOk], 0 );
Listing #1 : Delphi code. Download exepath (0.23 KB).

Twitter Delicious Facebook Digg Stumbleupon Favorites More

Design by Kang Iwan K-sev | Thank's for your visit To My Site - Ridwan Mulyana | Cibeureum