0 0 Votes

Delphi/Lazarus: Get Name of own Application

Question by Compi | 06/06/2016 at 16:09

Is there any possibility to determine or retrieve the name of the EXE file of the own program? For example "MyProgram.exe" or whatever the name is?

Of course, theoretically, I know how I have named my own EXE, but, however, the user could have named the program file to any other arbitrary name. And this is the case I would like to check for.

ReplyPositiveNegative

Delphian

Show Profile | Message
Avatar
0Best Answer
0 Votes

You can read out the EXE file of your own application by using Paramstr(0) as a well as Application.ExeName.

However, both ways are additionally providing the complete application path, so that you have to divide path and program name from each other:

var
  MyEXE: string;
begin

  MyEXE := ExtractFileName(Application.ExeName);

  // or

  MyEXE := ExtractFileName(Paramstr(0));

end;

With ExtractFileName(), you can cut off the path from your program file so that you will get the name of your EXE.
07/06/2016 at 11:24

ReplyPositive Negative
Reply

Related Topics

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.

Participate

Ask your own question or write your own articles on askingbox.com. How to do.