unit Childwin;

interface

uses Windows, Classes, Graphics, Forms, Controls, StdCtrls, Buttons, sysutils,
     ActiveX, AggrLib_TLB;

type
  TMDIChild = class(TForm, ITypaMyAdvise)
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormPaint(Sender: TObject);
  private
    { Private declarations }
   Nimg:integer;
  public
    { Public declarations }
   procedure OnXTime; stdcall;
   constructor Create(AOwner: TComponent); override;    
  end;

implementation

uses Main;

{$R *.DFM}

constructor TMDIChild.Create(AOwner: TComponent);
begin
  inherited;
  Nimg := 0;
  if S_OK <> OAggr.SetAdvise(ITypaMyAdvise(Self)) then
    raise Exception.Create('Хватит !');
end;

procedure TMDIChild.OnXTime;
begin
 inc(Nimg);
 if Nimg>29 then Nimg := 0;
 Repaint;
end;

procedure TMDIChild.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  Action := caFree;
  OAggr.Unadvise(ITypaMyAdvise(Self));
end;

procedure TMDIChild.FormPaint(Sender: TObject);
begin
 MainForm.ImageList1.Draw(Canvas, 30, 16, Nimg);
end;

end.
