unit Unit2;

{$WARN SYMBOL_PLATFORM OFF}

interface

uses
  Windows, Messages, SysUtils, Classes, ComServ, ComObj, VCLCom, DataBkr,
  DBClient, Project1_TLB, StdVcl, Provider, DB, ADODB;

type
  Ttsgl_server = class(TRemoteDataModule, Itsgl_server)
    ADOConnection1: TADOConnection;
    ADODataSet1: TADODataSet;
    DataSetProvider1: TDataSetProvider;
    ADOQuery1: TADOQuery;
    DataSetProvider2: TDataSetProvider;
    procedure RemoteDataModuleCreate(Sender: TObject);
    procedure RemoteDataModuleDestroy(Sender: TObject);
  private
    { Private declarations }
  protected
    class procedure UpdateRegistry(Register: Boolean; const ClassID, ProgID: string); override;
  public
    { Public declarations }
  end;

implementation

uses Unit1;

{$R *.DFM}

class procedure Ttsgl_server.UpdateRegistry(Register: Boolean; const ClassID, ProgID: string);
begin
  if Register then begin
    inherited UpdateRegistry(Register, ClassID, ProgID);
    EnableSocketTransport(ClassID);
    EnableWebTransport(ClassID);
  end
  else  begin
    DisableSocketTransport(ClassID);
    DisableWebTransport(ClassID);
    inherited UpdateRegistry(Register, ClassID, ProgID);
  end;
end;

procedure Ttsgl_server.RemoteDataModuleCreate(Sender: TObject);
begin
  with form1.Label2 do  begin
    caption:=inttostr(strtoint(caption)+1);  //连接数加1
  end;
end;

procedure Ttsgl_server.RemoteDataModuleDestroy(Sender: TObject);
begin
  with form1.Label2 do  begin
    caption:=inttostr(strtoint(caption)-1);  //连接数减1
  end;
end;

initialization
  TComponentFactory.Create(ComServer, Ttsgl_server,
    Class_tsgl_server, ciMultiInstance, tmApartment);
end.
