Filtri Menu 0 0.00

Tip – [DELPHI] : Read windows environment variables

Tip – [DELPHI] : Read windows environment variables

this function that i found on the Net allow your delphi code to access at environment variables of your Windows systems :

function GetEnvVarValue(const VarName: string): string;
var
  BufSize: Integer;  // buffer size required for value
begin
  // Get required buffer size (inc. terminal #0)
  BufSize := GetEnvironmentVariable(
    PChar(VarName), nil, 0);
  if BufSize > 0 then
  begin
    // Read env var value into result string
    SetLength(Result, BufSize - 1);
    GetEnvironmentVariable(PChar(VarName),
      PChar(Result), BufSize);
  end
  else
    // No such environment variable
    Result := '';
end;
Condividi:

Iscriviti alla newsletter

Iscriviti alla nostra newsletter per ricevere offerte di sconto anticipate, aggiornamenti e informazioni sui nuovi prodotti.
Top