...get your program's directory ?
Author: Simon Grossenbacher
{
To get your program's directory:
Das eigene Programm Verzeichnis/(den Anwendungspfad) ermitteln:
}
procedure TForm1.Button1Click(Sender: TObject);
var
sExePath: string;
begin
sExePath := ExtractFilePath(Application.ExeName)
ShowMessage(sExePath);
end;
{
To get your program's Exe-Name:
Und den Exe-Name:
}
procedure TForm1.Button2Click(Sender: TObject);
var
sExeName: string;
begin
sExeName := ExtractFileName(Application.ExeName);
ShowMessage(sExeName);
end;
{
Instead of Application.ExeName you can also use Paramstr(0)
Anstatt Application.ExeName kann man auch Paramstr(0) einsetzen
}
{
If you are working on a DLL and are interested in the filename of the
DLL rather than the filename of the application, then you can use this function:
}
function GetModuleName: string;
var
szFileName: array[0..MAX_PATH] of Char;
begin
FillChar(szFileName, SizeOf(szFileName), #0);
GetModuleFileName(hInstance, szFileName, MAX_PATH);
Result := szFileName;
end;
printed from
www.swissdelphicenter.ch
developers knowledge base