Board index » delphi » need to retreive dos environment vars

need to retreive dos environment vars

any ideas welcome but I do not have the windows API help file at present

ta stuart

 

Re:need to retreive dos environment vars


Following sample code may help:

http://www.chami.com/tips/delphi/010997D.html

Quote
Stuart Kinnear wrote in message <6a9li9$tn...@nuacht.iol.ie>...
>any ideas welcome but I do not have the windows API help file at present

>ta stuart

Re:need to retreive dos environment vars


The following function should help.  Make sure you include the "WinProcs"
(Delphi1) or "Windows" units (other) into the unit where you put this code:

function GetDosEnvironmentList(DosEnvironment: TStringList): boolean;
var
  EnvBlock : PChar;
begin
  try
    DosEnvironment.Clear;
    {$IFDEF WIN32}
    EnvBlock := GetEnvironmentStrings;
    {$ELSE}
    EnvBlock := GetDosEnvironment;
    {$ENDIF}
    while EnvBlock[0]<>#0 do
    begin
      DosEnvironment.Add(StrPas(EnvBlock));
      inc(EnvBlock, StrLen(EnvBlock)+1);
    end;
    Result := True;
  except
    Result := False;
  end;
end;

Quote
Stuart Kinnear wrote in message <6a9li9$tn...@nuacht.iol.ie>...
>any ideas welcome but I do not have the windows API help file at present

>ta stuart

Other Threads