Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Trucos (https://www.clubdelphi.com/foros/forumdisplay.php?f=52)
-   -   Cómo obtener las variables de entorno del DOS (https://www.clubdelphi.com/foros/showthread.php?t=80570)

dec 30-06-2006 14:12:42

Cómo obtener las variables de entorno del DOS
 
Cómo obtener las variables de entorno del DOS

Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject);
var
  Env : PChar;
  i : Integer;
  S : String;
  PosEq : Integer;

begin
  Env := GetDosEnvironment;
  With ListBox1,StringGrid1 do begin
    While Env^ <> #0 do begin
      Items.Add(StrPas(Env));
      Inc(Env,StrLen(Env)+1);
    end;
    RowCount := Items.Count;
    for i := 0 to Pred(Items.Count) do begin
      PosEq := Pos('=',Items[i]);
      Cells[0,i] := Copy(Items[i],1,PosEq-1);
      Cells[1,i] := Copy(Items[i],PosEq+1,Length(Items[i]));
    end;
  end;
end;


La franja horaria es GMT +2. Ahora son las 15:50:05.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi