⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 netlibrary_tlb.pas

📁 delphi7从入门到精通源代码
💻 PAS
📖 第 1 页 / 共 3 页
字号:
  end;
{$ENDIF}


// *********************************************************************//
// The Class Co_TClass provides a Create and CreateRemote method to          
// create instances of the default interface __TClass exposed by              
// the CoClass _TClass. The functions are intended to be used by             
// clients wishing to automate the CoClass objects exposed by the         
// server of this typelibrary.                                            
// *********************************************************************//
  Co_TClass = class
    class function Create: __TClass;
    class function CreateRemote(const MachineName: string): __TClass;
  end;

// *********************************************************************//
// The Class CoTNumber provides a Create and CreateRemote method to          
// create instances of the default interface _TNumber1 exposed by              
// the CoClass TNumber. The functions are intended to be used by             
// clients wishing to automate the CoClass objects exposed by the         
// server of this typelibrary.                                            
// *********************************************************************//
  CoTNumber = class
    class function Create: _TNumber1;
    class function CreateRemote(const MachineName: string): _TNumber1;
  end;


// *********************************************************************//
// OLE Server Proxy class declaration
// Server Object    : TTNumber
// Help String      : 
// Default Interface: _TNumber1
// Def. Intf. DISP? : No
// Event   Interface: 
// TypeFlags        : (2) CanCreate
// *********************************************************************//
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  TTNumberProperties= class;
{$ENDIF}
  TTNumber = class(TOleServer)
  private
    FIntf:        _TNumber1;
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
    FProps:       TTNumberProperties;
    function      GetServerProperties: TTNumberProperties;
{$ENDIF}
    function      GetDefaultInterface: _TNumber1;
  protected
    procedure InitServerData; override;
  public
    constructor Create(AOwner: TComponent); override;
    destructor  Destroy; override;
    procedure Connect; override;
    procedure ConnectTo(svrIntf: _TNumber1);
    procedure Disconnect; override;
    property DefaultInterface: _TNumber1 read GetDefaultInterface;
  published
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
    property Server: TTNumberProperties read GetServerProperties;
{$ENDIF}
  end;

{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
// *********************************************************************//
// OLE Server Properties Proxy Class
// Server Object    : TTNumber
// (This object is used by the IDE's Property Inspector to allow editing
//  of the properties of this server)
// *********************************************************************//
 TTNumberProperties = class(TPersistent)
  private
    FServer:    TTNumber;
    function    GetDefaultInterface: _TNumber1;
    constructor Create(AServer: TTNumber);
  protected
  public
    property DefaultInterface: _TNumber1 read GetDefaultInterface;
  published
  end;
{$ENDIF}


// *********************************************************************//
// The Class Co_Text provides a Create and CreateRemote method to          
// create instances of the default interface __Text exposed by              
// the CoClass _Text. The functions are intended to be used by             
// clients wishing to automate the CoClass objects exposed by the         
// server of this typelibrary.                                            
// *********************************************************************//
  Co_Text = class
    class function Create: __Text;
    class function CreateRemote(const MachineName: string): __Text;
  end;

// *********************************************************************//
// The Class Co_TNumber provides a Create and CreateRemote method to          
// create instances of the default interface __TNumber exposed by              
// the CoClass _TNumber. The functions are intended to be used by             
// clients wishing to automate the CoClass objects exposed by the         
// server of this typelibrary.                                            
// *********************************************************************//
  Co_TNumber = class
    class function Create: __TNumber;
    class function CreateRemote(const MachineName: string): __TNumber;
  end;

// *********************************************************************//
// The Class Co_FinalizeHandler provides a Create and CreateRemote method to          
// create instances of the default interface __FinalizeHandler exposed by              
// the CoClass _FinalizeHandler. The functions are intended to be used by             
// clients wishing to automate the CoClass objects exposed by the         
// server of this typelibrary.                                            
// *********************************************************************//
  Co_FinalizeHandler = class
    class function Create: __FinalizeHandler;
    class function CreateRemote(const MachineName: string): __FinalizeHandler;
  end;

// *********************************************************************//
// The Class CoBorland_Delphi_System_Unit provides a Create and CreateRemote method to          
// create instances of the default interface _Borland_Delphi_System_Unit exposed by              
// the CoClass Borland_Delphi_System_Unit. The functions are intended to be used by             
// clients wishing to automate the CoClass objects exposed by the         
// server of this typelibrary.                                            
// *********************************************************************//
  CoBorland_Delphi_System_Unit = class
    class function Create: _Borland_Delphi_System_Unit;
    class function CreateRemote(const MachineName: string): _Borland_Delphi_System_Unit;
  end;


// *********************************************************************//
// OLE Server Proxy class declaration
// Server Object    : TBorland_Delphi_System_Unit
// Help String      : 
// Default Interface: _Borland_Delphi_System_Unit
// Def. Intf. DISP? : No
// Event   Interface: 
// TypeFlags        : (2) CanCreate
// *********************************************************************//
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  TBorland_Delphi_System_UnitProperties= class;
{$ENDIF}
  TBorland_Delphi_System_Unit = class(TOleServer)
  private
    FIntf:        _Borland_Delphi_System_Unit;
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
    FProps:       TBorland_Delphi_System_UnitProperties;
    function      GetServerProperties: TBorland_Delphi_System_UnitProperties;
{$ENDIF}
    function      GetDefaultInterface: _Borland_Delphi_System_Unit;
  protected
    procedure InitServerData; override;
  public
    constructor Create(AOwner: TComponent); override;
    destructor  Destroy; override;
    procedure Connect; override;
    procedure ConnectTo(svrIntf: _Borland_Delphi_System_Unit);
    procedure Disconnect; override;
    property DefaultInterface: _Borland_Delphi_System_Unit read GetDefaultInterface;
  published
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
    property Server: TBorland_Delphi_System_UnitProperties read GetServerProperties;
{$ENDIF}
  end;

{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
// *********************************************************************//
// OLE Server Properties Proxy Class
// Server Object    : TBorland_Delphi_System_Unit
// (This object is used by the IDE's Property Inspector to allow editing
//  of the properties of this server)
// *********************************************************************//
 TBorland_Delphi_System_UnitProperties = class(TPersistent)
  private
    FServer:    TBorland_Delphi_System_Unit;
    function    GetDefaultInterface: _Borland_Delphi_System_Unit;
    constructor Create(AServer: TBorland_Delphi_System_Unit);
  protected
  public
    property DefaultInterface: _Borland_Delphi_System_Unit read GetDefaultInterface;
  published
  end;
{$ENDIF}


// *********************************************************************//
// The Class CoNetNumberClass_Unit provides a Create and CreateRemote method to          
// create instances of the default interface _NetNumberClass_Unit exposed by              
// the CoClass NetNumberClass_Unit. The functions are intended to be used by             
// clients wishing to automate the CoClass objects exposed by the         
// server of this typelibrary.                                            
// *********************************************************************//
  CoNetNumberClass_Unit = class
    class function Create: _NetNumberClass_Unit;
    class function CreateRemote(const MachineName: string): _NetNumberClass_Unit;
  end;


// *********************************************************************//
// OLE Server Proxy class declaration
// Server Object    : TNetNumberClass_Unit
// Help String      : 
// Default Interface: _NetNumberClass_Unit
// Def. Intf. DISP? : No
// Event   Interface: 
// TypeFlags        : (2) CanCreate
// *********************************************************************//
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  TNetNumberClass_UnitProperties= class;
{$ENDIF}
  TNetNumberClass_Unit = class(TOleServer)
  private
    FIntf:        _NetNumberClass_Unit;
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
    FProps:       TNetNumberClass_UnitProperties;
    function      GetServerProperties: TNetNumberClass_UnitProperties;
{$ENDIF}
    function      GetDefaultInterface: _NetNumberClass_Unit;
  protected
    procedure InitServerData; override;
  public
    constructor Create(AOwner: TComponent); override;
    destructor  Destroy; override;
    procedure Connect; override;
    procedure ConnectTo(svrIntf: _NetNumberClass_Unit);
    procedure Disconnect; override;
    property DefaultInterface: _NetNumberClass_Unit read GetDefaultInterface;
  published
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
    property Server: TNetNumberClass_UnitProperties read GetServerProperties;
{$ENDIF}
  end;

{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
// *********************************************************************//
// OLE Server Properties Proxy Class
// Server Object    : TNetNumberClass_Unit
// (This object is used by the IDE's Property Inspector to allow editing
//  of the properties of this server)
// *********************************************************************//
 TNetNumberClass_UnitProperties = class(TPersistent)
  private
    FServer:    TNetNumberClass_Unit;
    function    GetDefaultInterface: _NetNumberClass_Unit;
    constructor Create(AServer: TNetNumberClass_Unit);
  protected
  public
    property DefaultInterface: _NetNumberClass_Unit read GetDefaultInterface;
  published
  end;
{$ENDIF}


// *********************************************************************//
// The Class CoNetLibrary_Unit provides a Create and CreateRemote method to          
// create instances of the default interface _NetLibrary_Unit exposed by              
// the CoClass NetLibrary_Unit. The functions are intended to be used by             
// clients wishing to automate the CoClass objects exposed by the         
// server of this typelibrary.                                            
// *********************************************************************//
  CoNetLibrary_Unit = class
    class function Create: _NetLibrary_Unit;
    class function CreateRemote(const MachineName: string): _NetLibrary_Unit;
  end;


// *********************************************************************//
// OLE Server Proxy class declaration
// Server Object    : TNetLibrary_Unit
// Help String      : 
// Default Interface: _NetLibrary_Unit
// Def. Intf. DISP? : No
// Event   Interface: 
// TypeFlags        : (2) CanCreate
// *********************************************************************//
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  TNetLibrary_UnitProperties= class;
{$ENDIF}
  TNetLibrary_Unit = class(TOleServer)
  private
    FIntf:        _NetLibrary_Unit;
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
    FProps:       TNetLibrary_UnitProperties;
    function      GetServerProperties: TNetLibrary_UnitProperties;
{$ENDIF}
    function      GetDefaultInterface: _NetLibrary_Unit;
  protected
    procedure InitServerData; override;
  public
    constructor Create(AOwner: TComponent); override;
    destructor  Destroy; override;
    procedure Connect; override;
    procedure ConnectTo(svrIntf: _NetLibrary_Unit);
    procedure Disconnect; override;
    property DefaultInterface: _NetLibrary_Unit read GetDefaultInterface;
  published
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
    property Server: TNetLibrary_UnitProperties read GetServerProperties;
{$ENDIF}
  end;

{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
// *********************************************************************//
// OLE Server Properties Proxy Class
// Server Object    : TNetLibrary_Unit
// (This object is used by the IDE's Property Inspector to allow editing
//  of the properties of this server)
// *********************************************************************//
 TNetLibrary_UnitProperties = class(TPersistent)
  private
    FServer:    TNetLibrary_Unit;
    function    GetDefaultInterface: _NetLibrary_Unit;
    constructor Create(AServer: TNetLibrary_Unit);
  protected
  public
    property DefaultInterface: _NetLibrary_Unit read GetDefaultInterface;
  published
  end;
{$ENDIF}


procedure Register;

resourcestring
  dtlServerPage = 'Servers';

  dtlOcxPage = 'ActiveX';

implementation

uses ComObj;

class function CoText.Create: _Text1;
begin
  Result := CreateComObject(CLASS_Text) as _Text1;
end;

class function CoText.CreateRemote(const MachineName: string): _Text1;
begin
  Result := CreateRemoteComObject(MachineName, CLASS_Text) as _Text1;
end;

procedure TText.InitServerData;
const
  CServerData: TServerData = (
    ClassID:   '{27DF9B70-47B7-3326-B694-C8E1B9D9790F}';
    IntfIID:   '{6682B647-3B13-30EA-B364-C601AEF43B0B}';
    EventIID:  '';
    LicenseKey: nil;
    Version: 500);
begin
  ServerData := @CServerData;
end;

procedure TText.Connect;
var
  punk: IUnknown;
begin
  if FIntf = nil then
  begin
    punk := GetServer;
    Fintf:= punk as _Text1;
  end;
end;

procedure TText.ConnectTo(svrIntf: _Text1);
begin
  Disconnect;
  FIntf := svrIntf;
end;

procedure TText.DisConnect;
begin
  if Fintf <> nil then
  begin
    FIntf := nil;
  end;
end;

function TText.GetDefaultInterface: _Text1;
begin
  if FIntf = nil then
    Connect;
  Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
  Result := FIntf;
end;

constructor TText.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  FProps := TTextProperties.Create(Self);
{$ENDIF}
end;

destructor TText.Destroy;
begin
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  FProps.Free;
{$ENDIF}
  inherited Destroy;
end;

{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
function TText.GetServerProperties: TTextProperties;
begin
  Result := FProps;
end;
{$ENDIF}

{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
constructor TTextProperties.Create(AServer: TText);
begin
  inherited Create;
  FServer := AServer;
end;

function TTextProperties.GetDefaultInterface: _Text1;
begin

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -