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.

TPJCustomConsoleApp class

Project: Console Application Runner Classes

Unit: PJConsoleApp

Applies to: ~>3.0

Description

This is the base class for TPJConsoleApp. It implements all the functionality of that class, but declares all properties and events as protected. TPJConsoleApp simply redeclares all the properties and events as public.

If you intend to sub-class TPJConsoleApp you should actually subclass TPJCustomConsoleApp instead and publish just those properties you wish to expose. TPJCustomConsoleApp has three protected virtual methods that can be overridden in descendants if required (see below).

Methods

Public

Method Description
Execute Executes the console application.
Terminate Attempts to terminate the console application process.

Protected

Implementers of new derived classes may need to override these methods. All other users can safely ignore them.

Method Description
DoComplete Triggers the OnComplete event.
DoStart Triggers the OnStart event.
DoWork Triggers the OnWork event.

Properties

All properties are protected.

Property Description
CommandLine Command line used to execute a console application.
ConsoleColors Foreground and background colours used in console window.
ConsoleTitle Title to be displayed in any new console window.
CurrentDir Application’s current directory.
ElapsedTime Approximate time in milliseconds since the console application began executing.
Environment Pointer to the environment block used by the console application.
ErrorCode Provides information about any error that occurred while attempting to run a console application.
ErrorMessage Error message corresponding to any non-zero value of ErrorCode.
ExitCode Exit code returned by the console application on completion.
KillTimedOutProcess Indicates whether timed-out processes should be terminated or left running.
MaxExecTime Maximum permitted execution time of the console application.
Priority Priority with which the console application is started.
ProcessAttrs Specifies security and inheritance attributes for the console application process.
ProcessInfo Provides process information for the executing console application.
ScreenBufferSize Size of console’s screen buffer.
StdErr The console application’s standard error handle.
StdIn The console application’s standard input handle.
StdOut The console application’s standard output handle.
ThreadAttrs Security and inheritance attributes for the console application’s primary thread.
TimeSlice Length of each time slice for a timed sliced console application.
TimeToLive Amount of time a console application has left to run before timing out.
UnicodeEnvironment [~>3.1] Determines whether environment block referenced by Environment is in Unicode or ANSI.
UseNewConsole Determines if a console application opens a new console window when run.
Visible Determines whether the console application is to be displayed.
WindowPosition Position of console window on screen.
WindowSize Size of console window.

Events

All events are protected

Event Description
OnComplete Triggered when an application completes or times out.
OnStart Triggered after a console application process is created and just before it starts executing.
OnWork Triggered when the executing application yields control to this class. Permits necessary work to be completed.

See Also