Getting the evironment variables
   


Environment variables are useful to get detailed descriptions of your user's machines when they have a problem with your applications. This function can be used to retrieve the environment variables into a TStrings. Usage: drop a TMemo on the form & call the function like this: GetEnvVariables(Memo1.Lines);

procedure GetEnvVariables(EnvList: TStrings);
{ proc to retrieve all the environment variables }
{ and store them in a TStrings. }
var
  EnvPtr, SavePtr: PChar;
begin
  EnvPtr := GetEnvironmentStrings;
  SavePtr := EnvPtr;
  EnvList.Clear;
  repeat
    EnvList.Add(StrPas(EnvPtr));
    inc(EnvPtr, StrLen(EnvPtr) + 1);
  until
    EnvPtr^ = #0;
  FreeEnvironmentStrings(SavePtr);
end;


Blue Orb Software

[email protected]