whats new ¦  programming tips ¦  indy articles ¦  intraweb articles ¦  informations ¦  links ¦  interviews
 misc ¦  tutorials ¦  Add&Win Game

Tips (1541)

Database (90)
Files (137)
Forms (107)
Graphic (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Math (76)
Misc (126)
Multimedia (45)
Objects/
ActiveX (51)

OpenTools API (3)
Printing (35)
Strings (83)
System (266)
VCL (242)

Top15

Tips sort by
component


Search Tip

Add new Tip

Add&Win Game

Advertising

27 Visitors Online


 
...get your program's directory ?
Autor: Simon Grossenbacher
Homepage: http://www.swissdelphicenter.ch
[ Print tip ]  

Tip Rating (57):  
     


{
  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;

 

Rate this tip:

poor
very good


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners