Welcome to the new DelphiDabbler Code Library Documentation.

This is a new site that's currently running on alpha code. There are going to be bugs. If you discover any, please report them on the site's issues page (GitHub account required). Thanks.

Warning: Many URLs are going to change. Refer to the README file to discover which library project's documentation has been completed.

GetAll class methods

Project: Environment Variables Unit

Unit: PJEnvVars

Class: TPJEnvironmentVars

Applies to: ~>3.0

class function GetAll(const Vars: TStrings): Integer; overload;
class function GetAll: TPJEnvironmentVarArray; overload;

Description

There are two overloads of GetAll. Both of them get a list of all environment variables in the current process and return it to the user. The overloads differ in how the environment variables are returned.

TStrings overload

class function GetAll(const Vars: TStrings): Integer; overload;

This method returns the environment variables in the given string list in Name=Value format and returns the size of the environment block required to store all the variables.

Parameters

Returns

When nil is be passed to Vars the method returns the size of the block required for the environment variables, even though none are returned. Calling GetAll in this way is the equivalent, but not as clear, as calling the BlockSize method.

Important. Like BlockSize, GetAll deals with buffer sizes in characters, not bytes.

TPJEnvironmentVarArray overload

class function GetAll: TPJEnvironmentVarArray; overload;

This form of the method returns an array of records that give details of each environment variable.

Returns