Recent

Author Topic: Identifier not found "Application"  (Read 4741 times)

dietmar

  • Full Member
  • ***
  • Posts: 170
Identifier not found "Application"
« on: July 01, 2017, 10:24:48 am »
Hi,

when I try to determine the Exe-Name of my program (Application.ExeName) the error above occurs.
Ok, I could get around this with "ParamStr(0)", but that does only work in Windows.

Any guess why this identifier is lacking the "ExeName" (a property which works perfect in Delphi)?

Thx and nice weekend,
Dietmar
Lazarus 2.2.0RC1 with FPC 3.2.2 (32 Bit) on Windows10 (64Bit)

Xor-el

  • Sr. Member
  • ****
  • Posts: 404
Re: Identifier not found "Application"
« Reply #1 on: July 01, 2017, 11:15:07 am »
Add "forms" to your uses clause excluding the quotes.

Thaddy

  • Hero Member
  • *****
  • Posts: 10991
Re: Identifier not found "Application"
« Reply #2 on: July 01, 2017, 11:52:05 am »
Also that is not the case. Paramstr(0) is fully cross-platform.
Code: Pascal  [Select][+][-]
  1. program exename;
  2. begin
  3. writeln(ParamStr(0)); // Paramstr(0) is the name of the executable
  4. end.
« Last Edit: July 01, 2017, 12:06:50 pm by Thaddy »
The average programmer productivity is 4-5 hours per day. Peak performance 72 hours for short bursts. MTBF is 1 second or less.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 9699
  • FPC developer.
Re: Identifier not found "Application"
« Reply #3 on: July 01, 2017, 02:53:48 pm »
Did you include the same units as in Delphi ?

dietmar

  • Full Member
  • ***
  • Posts: 170
Re: Identifier not found "Application"
« Reply #4 on: July 01, 2017, 08:03:52 pm »
No, but the missing "uses Forms;" was indeed the problem... thank you!

Ok, I thought ParamStr(0) is only available in Windows... thank you ;)

Have a nice weekend,
DIetmar
Lazarus 2.2.0RC1 with FPC 3.2.2 (32 Bit) on Windows10 (64Bit)

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 9699
  • FPC developer.
Re: Identifier not found "Application"
« Reply #5 on: July 01, 2017, 10:12:05 pm »
No, but the missing "uses Forms;" was indeed the problem... thank you!

Ok, I thought ParamStr(0) is only available in Windows... thank you ;)

Afaik Paramstr(0) is generally available, but does not always contain the complete path.

 

TinyPortal © 2005-2018