Reputation: 6041
I compile the following code (COM object) in Delphi XE8 64-bit
function TUtility.GetDLLPath: WideString;
var
Buffer: array [0 .. C_MAX_PATH_LEN] of char;
begin
GetModuleFileName(hInstance, Buffer, Length(Buffer));
Result := Buffer;
end;
and I get the following path string (calling in VBScript)
C:\PROGRA~2\XYZ\AAABBB~1\64\Tools.dll
How do I get the long path instead of the short path?
Upvotes: 2
Views: 2214
Reputation: 613003
Call GetLongPathName
:
function LongPathName(const ShortPathName: string): string;
var
Retval: DWORD;
Buff: array [0..MAX_PATH-1] of Char;
begin
Retval := GetLongPathName(PChar(ShortPathName), Buff, Length(Buff));
Win32Check(Retval <> 0);
Result := Buff;
end;
Upvotes: 7