function IsOnIDE :Boolean;
begin
Result := LowerCase(ExtractFileName(ParamStr(0))) = 'lazarus.exe';
end;
Have you tried running this yourself? It won't work. ExtractFileName(ParamStr(0)) returns
your own project name. Even if you run it within Lazarus. Try it yourself. Please note... this is not for the lazarus.exe itself but for detecting if your own project is started from the IDE of Lazarus.
If you say it works you have created a project with the name lazarus yourself. Try creating a project with the name project1.
If you switch to Lazarus 1.6.2 (not released yet) it will detect if you're running with the debugger on (which is almost always the case). Only in rare situations will you use the option "Run without Debugger".
In that case (on Windows):
Yes, that will work. Even when running the option "Run without Debugger". Works in trunk in both 32 and 64bit and with and without Run without Debugger. (Although the main IDE has to be named lazarus.exe but that's obvious.)
Having Lazarus add an argument to the command line is simple and portable :-)
Yes, but you have to remember to put that in all your projects. It is cross-platform though.