DelphiDabbler Wiki



Console Application Runner ClassesTPJCustomConsoleApp class

Project: Console Application Runner Classes

Unit: PJConsoleApp.

Introduced: v1.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

MethodDescription
ExecuteExecutes the console application.
TerminateAttempts 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.

MethodDescription
DoCompleteTriggers the OnComplete event.
DoStart[v2.0] Triggers the OnStart event.
DoWorkTriggers the OnWork event.

Properties

All properties are protected.

PropertyDescription
CommandLine[v2.0] Command line used to execute a console application.
ConsoleColors[v2.0] Foreground and background colours used in console window.
ConsoleTitleTitle to be displayed in any new console window.
CurrentDir[v2.0] Application's current directory.
ElapsedTimeApproximate time in milliseconds since the console application began executing.
EnvironmentPointer to the environment block used by the console application.
ErrorCodeProvides information about any error that occurred while attempting to run a console application.
ErrorMessageError message corresponding to any non-zero value of ErrorCode.
ExitCodeExit code returned by the console application on completion.
KillTimedOutProcessIndicates whether timed-out processes should be terminated or left running.
MaxExecTimeMaximum permitted execution time of the console application.
PriorityPriority with which the console application is started.
ProcessAttrsSpecifies security and inheritance attributes for the console application process.
ProcessInfoProvides process information for the executing console application.
ScreenBufferSize[v2.0] Size of console's screen buffer.
StdErrThe console application's standard error handle.
StdInThe console application's standard input handle.
StdOutThe console application's standard output handle.
ThreadAttrsSecurity and inheritance attributes for the console application's primary thread.
TimeSliceLength of each time slice for a timed sliced console application.
TimeToLiveAmount of time a console application has left to run before timing out.
UnicodeEnvironment[v3.1] Determines whether environment block referenced by Environment is in Unicode or ANSI.
UseNewConsoleDetermines if a console application opens a new console window when run.
VisibleDetermines whether the console application is to be displayed.
WindowPosition[v2.0] Position of console window on screen.
WindowSize[v2.0] Size of console window.

Events

All events are protected

EventDescription
OnCompleteTriggered when an application completes or times out.
OnStart[v2.0] Triggered after a console application process is created and just before it starts executing.
OnWorkTriggered when the executing application yields control to this class. Permits necessary work to be completed.

See Also

Page last modified on August 10, 2014, at 05:03 PM