UNIT testmain;

INTERFACE

USES
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

TYPE
  TForm1 = CLASS( TForm )
    Button1 : TButton;
    PROCEDURE FormCreate( Sender : TObject );
    PROCEDURE DisplaySomething( Sender : TObject );
    PROCEDURE FormDestroy( Sender : TObject );
  PRIVATE
    { Private declarations }
    MyOutput : Text;
  PUBLIC
    { Public declarations }
  END;

VAR
  Form1 : TForm1;

IMPLEMENTATION

USES
  DebugInterface;

{$R *.DFM}

PROCEDURE TForm1.FormCreate( Sender : TObject );
BEGIN
  OpenAuxDebugOutput(MyOutput , 2);  // Channel 1 .. 9 possible (0 = Main)
END;

PROCEDURE TForm1.DisplaySomething( Sender : TObject );
BEGIN
  WriteLn('Standard output (= MainChannel) used');
  WriteLn(DBChannels[1],'Channel 1 used');
  WriteLn(DBChannels[2],'Channel 2 used');
  WriteLn(DBChannels[3],'Channel 3 used');

  WriteLn(MyOutput, 'Auxilary Channel used, allocated is channel 2');
END;

PROCEDURE TForm1.FormDestroy( Sender : TObject );
BEGIN
  CloseAuxDebugOutput(MyOutput);
END;

END.

