home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / Runimage / Delphi50 / Demos / Ado / Rds / rserver_tlb.pas < prev   
Encoding:
Pascal/Delphi Source File  |  1999-08-11  |  9.5 KB  |  276 lines

  1. unit RServer_TLB;
  2.  
  3. // ************************************************************************ //
  4. // WARNING                                                                    
  5. // -------                                                                    
  6. // The types declared in this file were generated from data read from a       
  7. // Type Library. If this type library is explicitly or indirectly (via        
  8. // another type library referring to this type library) re-imported, or the   
  9. // 'Refresh' command of the Type Library Editor activated while editing the   
  10. // Type Library, the contents of this file will be regenerated and all        
  11. // manual modifications will be lost.                                         
  12. // ************************************************************************ //
  13.  
  14. // PASTLWTR : $Revision:   1.79  $
  15. // File generated on 6/24/99 8:08:50 AM from Type Library described below.
  16.  
  17. // ************************************************************************ //
  18. // Type Lib: D:\ADO\demos\RDS\RDSServer.tlb (1)
  19. // IID\LCID: {3C464A20-1DB2-11D3-931D-00C04FB17A5E}\0
  20. // Helpfile: 
  21. // DepndLst: 
  22. //   (1) v2.0 stdole, (C:\WINDOWS\SYSTEM\STDOLE2.TLB)
  23. //   (2) v2.1 ADODB, (C:\PROGRAM FILES\COMMON FILES\SYSTEM\ADO\msado15.dll)
  24. //   (3) v4.0 StdVCL, (D:\TP\BIN\STDVCL40.DLL)
  25. // ************************************************************************ //
  26. interface
  27.  
  28. uses Windows, ActiveX, Classes, Graphics, OleServer, OleCtrls, StdVCL, 
  29.   ADODB_TLB;
  30.  
  31. // *********************************************************************//
  32. // GUIDS declared in the TypeLibrary. Following prefixes are used:        
  33. //   Type Libraries     : LIBID_xxxx                                      
  34. //   CoClasses          : CLASS_xxxx                                      
  35. //   DISPInterfaces     : DIID_xxxx                                       
  36. //   Non-DISP interfaces: IID_xxxx                                        
  37. // *********************************************************************//
  38. const
  39.   // TypeLibrary Major and minor versions
  40.   RServerMajorVersion = 1;
  41.   RServerMinorVersion = 0;
  42.  
  43.   LIBID_RServer: TGUID = '{3C464A20-1DB2-11D3-931D-00C04FB17A5E}';
  44.  
  45.   IID_IRDSAppServer: TGUID = '{3C464A21-1DB2-11D3-931D-00C04FB17A5E}';
  46.   CLASS_RDSAppServer: TGUID = '{3C464A23-1DB2-11D3-931D-00C04FB17A5E}';
  47. type
  48.  
  49. // *********************************************************************//
  50. // Forward declaration of types defined in TypeLibrary                    
  51. // *********************************************************************//
  52.   IRDSAppServer = interface;
  53.   IRDSAppServerDisp = dispinterface;
  54.  
  55. // *********************************************************************//
  56. // Declaration of CoClasses defined in Type Library                       
  57. // (NOTE: Here we map each CoClass to its Default Interface)              
  58. // *********************************************************************//
  59.   RDSAppServer = IRDSAppServer;
  60.  
  61.  
  62. // *********************************************************************//
  63. // Interface: IRDSAppServer
  64. // Flags:     (4416) Dual OleAutomation Dispatchable
  65. // GUID:      {3C464A21-1DB2-11D3-931D-00C04FB17A5E}
  66. // *********************************************************************//
  67.   IRDSAppServer = interface(IDispatch)
  68.     ['{3C464A21-1DB2-11D3-931D-00C04FB17A5E}']
  69.     function  Get_Employee {Flags(1), (1/0) CC:0, INV:2, DBG:6}: _Recordset; safecall;
  70.     property Employee: _Recordset read Get_Employee;
  71.   end;
  72.  
  73. // *********************************************************************//
  74. // DispIntf:  IRDSAppServerDisp
  75. // Flags:     (4416) Dual OleAutomation Dispatchable
  76. // GUID:      {3C464A21-1DB2-11D3-931D-00C04FB17A5E}
  77. // *********************************************************************//
  78.   IRDSAppServerDisp = dispinterface
  79.     ['{3C464A21-1DB2-11D3-931D-00C04FB17A5E}']
  80.     property Employee {Flags(2), (1/0) CC:0, INV:2, DBG:6}: _Recordset readonly dispid 3;
  81.   end;
  82.  
  83. // *********************************************************************//
  84. // The Class CoRDSAppServer provides a Create and CreateRemote method to          
  85. // create instances of the default interface IRDSAppServer exposed by              
  86. // the CoClass RDSAppServer. The functions are intended to be used by             
  87. // clients wishing to automate the CoClass objects exposed by the         
  88. // server of this typelibrary.                                            
  89. // *********************************************************************//
  90.   CoRDSAppServer = class
  91.     class function Create: IRDSAppServer;
  92.     class function CreateRemote(const MachineName: string): IRDSAppServer;
  93.   end;
  94.  
  95.  
  96. // *********************************************************************//
  97. // OLE Server Proxy class declaration
  98. // Server Object    : TRDSAppServer
  99. // Help String      : RDSAppServer Object
  100. // Default Interface: IRDSAppServer
  101. // Def. Intf. DISP? : No
  102. // Event   Interface: 
  103. // TypeFlags        : (2) CanCreate
  104. // *********************************************************************//
  105. {$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  106.   TRDSAppServerProperties= class;
  107. {$ENDIF}
  108.   TRDSAppServer = class(TOleServer)
  109.   private
  110.     FIntf:        IRDSAppServer;
  111. {$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  112.     FProps:       TRDSAppServerProperties;
  113.     function      GetServerProperties: TRDSAppServerProperties;
  114. {$ENDIF}
  115.     function      GetDefaultInterface: IRDSAppServer;
  116.   protected
  117.     procedure InitServerData; override;
  118.   {CoClassWriteArrayPropMethods}
  119. // StdProp:
  120.     function  Get_Employee {Flags(1), (1/0) CC:0, INV:2, DBG:3}: _Recordset;
  121.   public
  122.     constructor Create(AOwner: TComponent); override;
  123.     destructor  Destroy; override;
  124.     procedure Connect; override;
  125.     procedure ConnectTo(svrIntf: IRDSAppServer);
  126.     procedure Disconnect; override;
  127.   {CoClassWriteMethods}
  128.     property  DefaultInterface: IRDSAppServer read GetDefaultInterface;
  129.   {CoClassWriteProperties}
  130.     property Employee {Flags(2), (1/0) CC:0, INV:2, DBG:2}: _Recordset read Get_Employee;
  131.   {CoClassWriteProperties}
  132.   published
  133. {$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  134.     property Server: TRDSAppServerProperties read GetServerProperties;
  135. {$ENDIF}
  136.   end;
  137.  
  138. {$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  139. // *********************************************************************//
  140. // OLE Server Properties Proxy Class
  141. // Server Object    : TRDSAppServer
  142. // (This object is used by the IDE's Property Inspector to allow editing
  143. //  of the properties of this server)
  144. // *********************************************************************//
  145.  TRDSAppServerProperties = class(TPersistent)
  146.   private
  147.     FServer:    TRDSAppServer;
  148.     function    GetDefaultInterface: IRDSAppServer;
  149.     constructor Create(AServer: TRDSAppServer);
  150.   protected
  151. // StdProp:
  152.     function  Get_Employee {Flags(1), (1/0) CC:0, INV:2, DBG:3}: _Recordset;
  153.   public
  154.     property DefaultInterface: IRDSAppServer read GetDefaultInterface;
  155.   published
  156.   end;
  157. {$ENDIF}
  158.  
  159.  
  160. procedure Register;
  161.  
  162. implementation
  163.  
  164. uses ComObj;
  165.  
  166. class function CoRDSAppServer.Create: IRDSAppServer;
  167. begin
  168.   Result := CreateComObject(CLASS_RDSAppServer) as IRDSAppServer;
  169. end;
  170.  
  171. class function CoRDSAppServer.CreateRemote(const MachineName: string): IRDSAppServer;
  172. begin
  173.   Result := CreateRemoteComObject(MachineName, CLASS_RDSAppServer) as IRDSAppServer;
  174. end;
  175.  
  176. procedure TRDSAppServer.InitServerData;
  177. const
  178.   CServerData: TServerData = (
  179.     ClassID:   '{3C464A23-1DB2-11D3-931D-00C04FB17A5E}';
  180.     IntfIID:   '{3C464A21-1DB2-11D3-931D-00C04FB17A5E}';
  181.     EventIID:  '';
  182.     LicenseKey: nil;
  183.     Version: 500);
  184. begin
  185.   ServerData := @CServerData;
  186. end;
  187.  
  188. procedure TRDSAppServer.Connect;
  189. var
  190.   punk: IUnknown;
  191. begin
  192.   if FIntf = nil then
  193.   begin
  194.     punk := GetServer;
  195.     Fintf:= punk as IRDSAppServer;
  196.   end;
  197. end;
  198.  
  199. procedure TRDSAppServer.ConnectTo(svrIntf: IRDSAppServer);
  200. begin
  201.   Disconnect;
  202.   FIntf := svrIntf;
  203. end;
  204.  
  205. procedure TRDSAppServer.DisConnect;
  206. begin
  207.   if Fintf <> nil then
  208.   begin
  209.     FIntf := nil;
  210.   end;
  211. end;
  212.  
  213. function TRDSAppServer.GetDefaultInterface: IRDSAppServer;
  214. begin
  215.   if FIntf = nil then
  216.     Connect;
  217.   Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
  218.   Result := FIntf;
  219. end;
  220.  
  221. constructor TRDSAppServer.Create(AOwner: TComponent);
  222. begin
  223.   inherited Create(AOwner);
  224. {$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  225.   FProps := TRDSAppServerProperties.Create(Self);
  226. {$ENDIF}
  227. end;
  228.  
  229. destructor TRDSAppServer.Destroy;
  230. begin
  231. {$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  232.   FProps.Free;
  233. {$ENDIF}
  234.   inherited Destroy;
  235. end;
  236.  
  237. {$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  238. function TRDSAppServer.GetServerProperties: TRDSAppServerProperties;
  239. begin
  240.   Result := FProps;
  241. end;
  242. {$ENDIF}
  243.  
  244. // StdProp:
  245. function  TRDSAppServer.Get_Employee {Flags(1), (1/0) CC:0, INV:2, DBG:3}: _Recordset;
  246. begin
  247.   Result := DefaultInterface.Get_Employee {Flags(1), (1/0) CC:0, INV:2, DBG:7};
  248. end;
  249.  
  250. {$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  251. constructor TRDSAppServerProperties.Create(AServer: TRDSAppServer);
  252. begin
  253.   inherited Create;
  254.   FServer := AServer;
  255. end;
  256.  
  257. function TRDSAppServerProperties.GetDefaultInterface: IRDSAppServer;
  258. begin
  259.   Result := FServer.DefaultInterface;
  260. end;
  261.  
  262. // StdProp:
  263. function  TRDSAppServerProperties.Get_Employee {Flags(1), (1/0) CC:0, INV:2, DBG:3}: _Recordset;
  264. begin
  265.   Result := DefaultInterface.Get_Employee {Flags(1), (1/0) CC:0, INV:2, DBG:7};
  266. end;
  267.  
  268. {$ENDIF}
  269.  
  270. procedure Register;
  271. begin
  272.   RegisterComponents('Servers',[TRDSAppServer]);
  273. end;
  274.  
  275. end.
  276.