unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    ScrollBar1: TScrollBar;
    Button1: TButton;
    Button2: TButton;
    procedure Button2Click(Sender: TObject);
    procedure ScrollBar1Change(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  Serwer :Variant;

implementation

uses ComObj;

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
Serwer:=CreateOleObject('Project1.AutoProgressBar');
Serwer.Clear;
ScrollBar1.Enabled:=True;
end;

procedure TForm1.ScrollBar1Change(Sender: TObject);
begin
Serwer.Position:=ScrollBar1.Position;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
Serwer:=Null;
//Serwer:=Unassigned;
ScrollBar1.Enabled:=False;
end;

end.
