Application.ExeName in a DLL

Can I just confirm that calling Application.ExeName WILL return the calling application's name, rather than the DLL? This is for 95/98/ME/XP/2k - if any of these work differently, please say so. This is something I want, I don't need the DLL's name.

Application.Exename will call ParamStr(0). If you call the DLL from a Delphi application then this will return the name of the executable. However, this isn't always guarantueed! Normally you would use
var
NameBuffer: array[0..MAX_PATH] of char;
Filename: string;
begin
GetModuleFileName(HInstance, NameBuffer, MAX_PATH);
Filename := NameBuffer;

but this will return the DLL name, not the executable name. But if you use MainInstance instead of HInstance then you use the instance of the executable. Thus:
GetModuleFileName(MainInstance, NameBuffer, MAX_PATH);
should return the executable name in the NameBuffer variable.

But in general you could also use ParamStr(0) in almost all cases. There might be some special occasions where it won't work but those are quite rare.

Geoff, it should work and in general it will work. The only problems I've discovered in the past were COM objects inside a DLL that took rundll.exe as executable name instead of the executable that was really calling them. And I once had a problem with some scripting engine that allowed you to call methods from a DLL but this engine would link the wrong executable to the DLL. But in general, a plain, simple DLL should work just fine with ParamStr(0)...