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.

Environment property

Project: Console Application Runner Classes

Unit: PJConsoleApp

Classes: TPJCustomConsoleApp, TPJConsoleApp

Applies to: ~>3.0

property Environment: Pointer;

Description

Environment references the environment block to be used by the console application or is nil if the child process is to inherit the parent process’ environment block.

If the property is not nil then the memory it points to must not be freed until the console application has finished executing.

The default value is nil.

Remarks

To give a console application its own environment block you must:

See this article and its demo code for information on setting up environment blocks.

[>=3.0 & <3.1] The environment variables contained in the block must be encoded as a sequence of AnsiChar characters regardless of whether a Unicode or ANSI Delphi compiler is used.

[~>3.1] The environment variables contained in the block must be stored as a sequence of WideChar characters if the UnicodeEnvironment property is True or as a sequence of AnsiChar characters otherwise. Important: The memory allocated for the block must allow for the size of characters used.

The property is public in TPJConsoleApp and protected in TPJCustomConsoleApp.