TApxProtocol.OnProtocolFinish

TApxProtocol

property OnProtocolFinish : TProtocolFinishEvent
TProtocolFinishEvent = procedure(
  CP : TObject; ErrorCode : SmallInt) of object;

Defines an event handler that is called when a protocol transfer ends.

This event is generated whether the protocol ends successfully or not. If it ends successfully, ErrorCode is zero. Otherwise, ErrorCode is a number indicating the type of error. CP is the protocol component that generated the error.

An application could use this handler to display a completion dialog box (needed only if a protocol status event handler is not also in use) or to enable the scheduling of another file transfer.

The following example displays a message whenever a protocol finishes, and enables an associated terminal window to accept data again:

procedure TForm1.ApxProtocol1ProtocolFinish(
  CP : TObject; ErrorCode : SmallInt);
begin
  ShowMessage('Protocol finished: '+ErrorMsg(ErrorCode));
  ApxTerminal1.Active := True;
end;

See also: InProgress, OnProtocolError