...Even when a user opens an application by double-clicking an associated file in a directory that's different from the executable. I've always used ExtractFilePath(Application.EXEName), but this function doesn't work as hoped in this circumstance.
A:
Also try ParamStr(0). Maybe that works when application.exename doesn't?
Chris Thornton
2010-10-27 22:41:13
That's exactly what the `ExeName` property returns.
Rob Kennedy
2010-10-27 22:42:24
+5
A:
ExeName
returns ParamStr(0)
which in turn returns the string produced by GetModuleFileName
with hModule
set to 0. I cannot see any reason why this wouldn't work in a normal application.
Andreas Rejbrand
2010-10-27 22:48:10
A:
ExePath := ExtractFilePath(paramstr(0));
I do it all the time, and it always works, whatever OS it is running on.
A.Bouchez
2010-10-28 06:06:41