Title: How to resolve environment variables
function ExpandEnvironment(const strValue: string): string;
var
chrResult: array[0..1023] of Char;
wrdReturn: DWORD;
begin
wrdReturn := ExpandEnvironmentStrings(PChar(strValue), chrResult, 1024);
if wrdReturn = 0 then
Result := strValue
else
begin
Result := Trim(chrResult);
end;
end;
Usage Examples:
Example, Beispiel:
EditPath.Text := ExpandEnvironment('%systemroot%\Temp\');
Result under NT, Ergebnis unter WIN NT:
C:\WINNT\Temp\