Order and save right now!
20% off with the 729824315 dicscount code for Ultimate Pack and any another product for Delphi from Greatis Programming! |
⤷ Get all environment variables
To get a full list of environment variables, use GetEnvironmentStrings function. But it is necessary to process result.
procedure TForm1.Button1Click(Sender: TObject);
var
Variable: Boolean;
Str: PChar;
Res: string;
begin
Str:=GetEnvironmentStrings;
Res:='';
Variable:=False;
while True do begin
if Str^=#0 then
begin
if Variable then Memo1.Lines.Add(Res);
Variable:=True;
Inc(Str);
Res:='';
if Str^=#0 then
Break
else
Res:=Res+str^;
end
else
if Variable then Res:=Res+Str^;
Inc(str);
end;
end;
-
More for developers