DelphiDabbler Wiki

Console Application Runner ClassesOnWork event

Project: Console Application Runner Classes

Unit: PJConsoleApp

Classes: TPJCustomConsoleApp, TPJConsoleApp

Introduced: v1.0

property OnWork: TNotifyEvent;


This event is triggered when the executing application yields control to this class. The frequency with which the event is triggered depends on the value of the TimeSlice property - the smaller the value the more frequently the event is triggered.

Handle the event to perform any required processing between time slices. Examples of the kind of processing you may wish to perform are:

  • Updating a progress meter in the main application, or reporting time to live or elapsed time since the application began executing.
  • Processing data written by the console application to redirected standard output or standard error. The most common way to do this is via a pipe.
  • GUI applications that update the user interface should call Application.ProcessMessages in the OnWork event handler to let the application refresh the interface.

This event is never triggered if TimeSlice is INFINITE.


The event is public in TPJConsoleApp and protected in TPJCustomConsoleApp.

Page last modified on May 08, 2011, at 01:12 PM