Как получить переменные среды?
procedure GetEnvironmentStrings( st: TStrings );
var
ptr: PChar;
s: string;
done: boolean;
begin
st.Clear;
s := '';
done := false;
ptr := windows.GetEnvironmentStrings;
while done = false do
begin
if ptr^ = #0 then
begin
Inc( ptr );
if ptr^ = #0 then
done := true
else
st.Add( s );
s := ptr^;
end
else
s := s + ptr^;
Inc( ptr );
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
GetEnvironmentStrings( Memo1.Lines );
end;
|