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

📄 project1_tlb.pas

📁 Delphi6分布式开发例程 )
💻 PAS
字号:
unit Project1_TLB;

// ************************************************************************ //
// WARNING                                                                    
// -------                                                                    
// The types declared in this file were generated from data read from a       
// Type Library. If this type library is explicitly or indirectly (via        
// another type library referring to this type library) re-imported, or the   
// 'Refresh' command of the Type Library Editor activated while editing the   
// Type Library, the contents of this file will be regenerated and all        
// manual modifications will be lost.                                         
// ************************************************************************ //

// PASTLWTR : $Revision:   1.130  $
// File generated on 2001-8-28 16:01:05 from Type Library described below.

// ************************************************************************  //
// Type Lib: D:\delphi\新建文件夹\Project1.tlb (1)
// LIBID: {3FE6E324-DE55-4BF8-BFD5-71F9096F2FC9}
// LCID: 0
// Helpfile: 
// DepndLst: 
//   (1) v2.0 stdole, (C:\WINNT\System32\stdole2.tlb)
//   (2) v4.0 StdVCL, (C:\WINNT\System32\stdvcl40.dll)
// ************************************************************************ //
{$TYPEDADDRESS OFF} // Unit must be compiled without type-checked pointers. 
{$WARN SYMBOL_PLATFORM OFF}
{$WRITEABLECONST ON}

interface

uses ActiveX, Classes, CORBAObj, CorbaStd, Graphics, OrbPas, StdVCL, 
SysUtils, Variants, Windows;
  

// *********************************************************************//
// GUIDS declared in the TypeLibrary. Following prefixes are used:        
//   Type Libraries     : LIBID_xxxx                                      
//   CoClasses          : CLASS_xxxx                                      
//   DISPInterfaces     : DIID_xxxx                                       
//   Non-DISP interfaces: IID_xxxx                                        
// *********************************************************************//
const
  // TypeLibrary Major and minor versions
  Project1MajorVersion = 1;
  Project1MinorVersion = 0;

  LIBID_Project1: TGUID = '{3FE6E324-DE55-4BF8-BFD5-71F9096F2FC9}';

  IID_IWaitingServer: TGUID = '{5EBF7E47-4356-4F27-B7F4-B5067B52CD56}';
  CLASS_WaitingServer: TGUID = '{281CCFCB-4893-4444-BE92-E1ED0B2C39C6}';
  IID_ISleepingServer: TGUID = '{C4B5DF05-73B6-47A7-8CE6-D85B83F1ADC3}';
  CLASS_SleepingServer: TGUID = '{112BB970-F43D-4711-8AD5-B4B3C369F8C9}';
type

// *********************************************************************//
// Forward declaration of types defined in TypeLibrary                    
// *********************************************************************//
  IWaitingServer = interface;
  IWaitingServerDisp = dispinterface;
  ISleepingServer = interface;
  ISleepingServerDisp = dispinterface;

// *********************************************************************//
// Declaration of CoClasses defined in Type Library                       
// (NOTE: Here we map each CoClass to its Default Interface)              
// *********************************************************************//
  WaitingServer = IWaitingServer;
  SleepingServer = ISleepingServer;


// *********************************************************************//
// Interface: IWaitingServer
// Flags:     (4416) Dual OleAutomation Dispatchable
// GUID:      {5EBF7E47-4356-4F27-B7F4-B5067B52CD56}
// *********************************************************************//
  IWaitingServer = interface(IDispatch)
    ['{5EBF7E47-4356-4F27-B7F4-B5067B52CD56}']
    procedure WaitingProcess(const ThreadID: WideString; Duration: Integer); safecall;
  end;

// *********************************************************************//
// DispIntf:  IWaitingServerDisp
// Flags:     (4416) Dual OleAutomation Dispatchable
// GUID:      {5EBF7E47-4356-4F27-B7F4-B5067B52CD56}
// *********************************************************************//
  IWaitingServerDisp = dispinterface
    ['{5EBF7E47-4356-4F27-B7F4-B5067B52CD56}']
    procedure WaitingProcess(const ThreadID: WideString; Duration: Integer); dispid 1;
  end;

  TWaitingServerStub = class(TCorbaDispatchStub, IWaitingServer)
  public
    procedure WaitingProcess(const ThreadID: WideString; Duration: Integer); safecall;
  end;

  TWaitingServerSkeleton = class(TCorbaSkeleton)
  private
    FIntf: IWaitingServer;
  public
    constructor Create(const InstanceName: string; const Impl: IUnknown); override;
    procedure GetImplementation(out Impl: IUnknown); override; stdcall;
  published
    procedure WaitingProcess(const InBuf: IMarshalInBuffer; Cookie: Pointer);
  end;

// *********************************************************************//
// Interface: ISleepingServer
// Flags:     (4416) Dual OleAutomation Dispatchable
// GUID:      {C4B5DF05-73B6-47A7-8CE6-D85B83F1ADC3}
// *********************************************************************//
  ISleepingServer = interface(IDispatch)
    ['{C4B5DF05-73B6-47A7-8CE6-D85B83F1ADC3}']
    procedure SleepingProcess(const ThreadID: WideString; Duration: Integer); safecall;
  end;

// *********************************************************************//
// DispIntf:  ISleepingServerDisp
// Flags:     (4416) Dual OleAutomation Dispatchable
// GUID:      {C4B5DF05-73B6-47A7-8CE6-D85B83F1ADC3}
// *********************************************************************//
  ISleepingServerDisp = dispinterface
    ['{C4B5DF05-73B6-47A7-8CE6-D85B83F1ADC3}']
    procedure SleepingProcess(const ThreadID: WideString; Duration: Integer); dispid 1;
  end;

  TSleepingServerStub = class(TCorbaDispatchStub, ISleepingServer)
  public
    procedure SleepingProcess(const ThreadID: WideString; Duration: Integer); safecall;
  end;

  TSleepingServerSkeleton = class(TCorbaSkeleton)
  private
    FIntf: ISleepingServer;
  public
    constructor Create(const InstanceName: string; const Impl: IUnknown); override;
    procedure GetImplementation(out Impl: IUnknown); override; stdcall;
  published
    procedure SleepingProcess(const InBuf: IMarshalInBuffer; Cookie: Pointer);
  end;

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

  TWaitingServerCorbaFactory = class
    class function CreateInstance(const InstanceName: string): IWaitingServer;
  end;

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

  TSleepingServerCorbaFactory = class
    class function CreateInstance(const InstanceName: string): ISleepingServer;
  end;

implementation

uses ComObj;

{ TWaitingServerStub }

procedure TWaitingServerStub.WaitingProcess(const ThreadID: WideString; Duration: Integer);
var
  OutBuf: IMarshalOutBuffer;
  InBuf: IMarshalInBuffer;
begin
  FStub.CreateRequest('WaitingProcess', True, OutBuf);
  OutBuf.PutWideText(PWideChar(Pointer(ThreadID)));
  OutBuf.PutLong(Duration);
  FStub.Invoke(OutBuf, InBuf);
end;

{ TWaitingServerSkeleton }

constructor TWaitingServerSkeleton.Create(const InstanceName: string; const Impl: IUnknown);
begin
  inherited;
  inherited InitSkeleton('WaitingServer', InstanceName, 'IDL:Project1/IWaitingServer:1.0', tmMultiThreaded, True);
  FIntf := Impl as IWaitingServer;
end;

procedure TWaitingServerSkeleton.GetImplementation(out Impl: IUnknown);
begin
  Impl := FIntf;
end;

procedure TWaitingServerSkeleton.WaitingProcess(const InBuf: IMarshalInBuffer; Cookie: Pointer);
var
  OutBuf: IMarshalOutBuffer;
  ThreadID: WideString;
  Duration: Integer;
begin
  ThreadID := UnmarshalWideText(InBuf);
  Duration := InBuf.GetLong;
  FIntf.WaitingProcess(ThreadID, Duration);
  FSkeleton.GetReplyBuffer(Cookie, OutBuf);
end;

{ TSleepingServerStub }

procedure TSleepingServerStub.SleepingProcess(const ThreadID: WideString; Duration: Integer);
var
  OutBuf: IMarshalOutBuffer;
  InBuf: IMarshalInBuffer;
begin
  FStub.CreateRequest('SleepingProcess', True, OutBuf);
  OutBuf.PutWideText(PWideChar(Pointer(ThreadID)));
  OutBuf.PutLong(Duration);
  FStub.Invoke(OutBuf, InBuf);
end;

{ TSleepingServerSkeleton }

constructor TSleepingServerSkeleton.Create(const InstanceName: string; const Impl: IUnknown);
begin
  inherited;
  inherited InitSkeleton('SleepingServer', InstanceName, 'IDL:Project1/ISleepingServer:1.0', tmMultiThreaded, True);
  FIntf := Impl as ISleepingServer;
end;

procedure TSleepingServerSkeleton.GetImplementation(out Impl: IUnknown);
begin
  Impl := FIntf;
end;

procedure TSleepingServerSkeleton.SleepingProcess(const InBuf: IMarshalInBuffer; Cookie: Pointer);
var
  OutBuf: IMarshalOutBuffer;
  ThreadID: WideString;
  Duration: Integer;
begin
  ThreadID := UnmarshalWideText(InBuf);
  Duration := InBuf.GetLong;
  FIntf.SleepingProcess(ThreadID, Duration);
  FSkeleton.GetReplyBuffer(Cookie, OutBuf);
end;

class function CoWaitingServer.Create: IWaitingServer;
begin
  Result := CreateComObject(CLASS_WaitingServer) as IWaitingServer;
end;

class function CoWaitingServer.CreateRemote(const MachineName: string): IWaitingServer;
begin
  Result := CreateRemoteComObject(MachineName, CLASS_WaitingServer) as IWaitingServer;
end;

class function TWaitingServerCorbaFactory.CreateInstance(const InstanceName: string): IWaitingServer;
begin
  Result := CorbaFactoryCreateStub('IDL:Project1/WaitingServerFactory:1.0', 'WaitingServer',
    InstanceName, '', IWaitingServer) as IWaitingServer;
end;

class function CoSleepingServer.Create: ISleepingServer;
begin
  Result := CreateComObject(CLASS_SleepingServer) as ISleepingServer;
end;

class function CoSleepingServer.CreateRemote(const MachineName: string): ISleepingServer;
begin
  Result := CreateRemoteComObject(MachineName, CLASS_SleepingServer) as ISleepingServer;
end;

class function TSleepingServerCorbaFactory.CreateInstance(const InstanceName: string): ISleepingServer;
begin
  Result := CorbaFactoryCreateStub('IDL:Project1/SleepingServerFactory:1.0', 'SleepingServer',
    InstanceName, '', ISleepingServer) as ISleepingServer;
end;

initialization
  CorbaStubManager.RegisterStub(IWaitingServer, TWaitingServerStub);
  CorbaInterfaceIDManager.RegisterInterface(IWaitingServer, 'IDL:Project1/IWaitingServer:1.0');
  CorbaSkeletonManager.RegisterSkeleton(IWaitingServer, TWaitingServerSkeleton);
  CorbaStubManager.RegisterStub(ISleepingServer, TSleepingServerStub);
  CorbaInterfaceIDManager.RegisterInterface(ISleepingServer, 'IDL:Project1/ISleepingServer:1.0');
  CorbaSkeletonManager.RegisterSkeleton(ISleepingServer, TSleepingServerSkeleton);

end.

⌨️ 快捷键说明

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