home *** CD-ROM | disk | FTP | other *** search
/ Delphi Anthology / aDELPHI.iso / Runimage / Delphi50 / Demos / Midas / Login / server_tlb.pas < prev    next >
Pascal/Delphi Source File  |  1999-08-11  |  11KB  |  247 lines

  1. unit Server_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.51  $
  15. // File generated on 4/9/99 12:42:52 PM from Type Library described below.
  16.  
  17. // ************************************************************************ //
  18. // Type Lib: D:\Temp\demos\MIDAS\LOGIN\Server.tlb
  19. // IID\LCID: {5E6A5BD2-F709-11D1-AABE-00C04FA35CFA}\0
  20. // Helpfile: 
  21. // DepndLst: 
  22. //   (1) v4.0 StdVCL, (D:\TP\bin\stdvcl40.dll)
  23. //   (2) v2.0 stdole, (C:\WINNTS\system32\stdole2.tlb)
  24. //   (3) v1.0 Midas, (D:\tp5\bin\midas.dll)
  25. // ************************************************************************ //
  26. interface
  27.  
  28. uses Windows, ActiveX, Classes, Graphics, OleServer, OleCtrls, StdVCL, 
  29.   MIDAS;
  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.   LIBID_Server: TGUID = '{5E6A5BD2-F709-11D1-AABE-00C04FA35CFA}';
  40.   IID_ILoginDemo: TGUID = '{5E6A5BD3-F709-11D1-AABE-00C04FA35CFA}';
  41.   CLASS_LoginDemo: TGUID = '{5E6A5BD5-F709-11D1-AABE-00C04FA35CFA}';
  42. type
  43.  
  44. // *********************************************************************//
  45. // Forward declaration of types defined in TypeLibrary                    
  46. // *********************************************************************//
  47.   ILoginDemo = interface;
  48.   ILoginDemoDisp = dispinterface;
  49.  
  50. // *********************************************************************//
  51. // Declaration of CoClasses defined in Type Library                       
  52. // (NOTE: Here we map each CoClass to its Default Interface)              
  53. // *********************************************************************//
  54.   LoginDemo = ILoginDemo;
  55.  
  56.  
  57. // *********************************************************************//
  58. // Interface: ILoginDemo
  59. // Flags:     (4416) Dual OleAutomation Dispatchable
  60. // GUID:      {5E6A5BD3-F709-11D1-AABE-00C04FA35CFA}
  61. // *********************************************************************//
  62.   ILoginDemo = interface(IAppServer)
  63.     ['{5E6A5BD3-F709-11D1-AABE-00C04FA35CFA}']
  64.     procedure Login(const UserName: WideString; const Password: WideString); safecall;
  65.   end;
  66.  
  67. // *********************************************************************//
  68. // DispIntf:  ILoginDemoDisp
  69. // Flags:     (4416) Dual OleAutomation Dispatchable
  70. // GUID:      {5E6A5BD3-F709-11D1-AABE-00C04FA35CFA}
  71. // *********************************************************************//
  72.   ILoginDemoDisp = dispinterface
  73.     ['{5E6A5BD3-F709-11D1-AABE-00C04FA35CFA}']
  74.     procedure Login(const UserName: WideString; const Password: WideString); dispid 2;
  75.     function  AS_ApplyUpdates(const ProviderName: WideString; Delta: OleVariant; 
  76.                               MaxErrors: Integer; out ErrorCount: Integer; var OwnerData: OleVariant): OleVariant; dispid 20000000;
  77.     function  AS_GetRecords(const ProviderName: WideString; Count: Integer; out RecsOut: Integer; 
  78.                             Options: Integer; const CommandText: WideString; 
  79.                             var Params: OleVariant; var OwnerData: OleVariant): OleVariant; dispid 20000001;
  80.     function  AS_DataRequest(const ProviderName: WideString; Data: OleVariant): OleVariant; dispid 20000002;
  81.     function  AS_GetProviderNames: OleVariant; dispid 20000003;
  82.     function  AS_GetParams(const ProviderName: WideString; var OwnerData: OleVariant): OleVariant; dispid 20000004;
  83.     function  AS_RowRequest(const ProviderName: WideString; Row: OleVariant; RequestType: Integer; 
  84.                             var OwnerData: OleVariant): OleVariant; dispid 20000005;
  85.     procedure AS_Execute(const ProviderName: WideString; const CommandText: WideString; 
  86.                          var Params: OleVariant; var OwnerData: OleVariant); dispid 20000006;
  87.   end;
  88.  
  89. // *********************************************************************//
  90. // The Class CoLoginDemo provides a Create and CreateRemote method to          
  91. // create instances of the default interface ILoginDemo exposed by              
  92. // the CoClass LoginDemo. The functions are intended to be used by             
  93. // clients wishing to automate the CoClass objects exposed by the         
  94. // server of this typelibrary.                                            
  95. // *********************************************************************//
  96.   CoLoginDemo = class
  97.     class function Create: ILoginDemo;
  98.     class function CreateRemote(const MachineName: string): ILoginDemo;
  99.   end;
  100.  
  101.  
  102. // *********************************************************************//
  103. // OLE Server Proxy class declaration
  104. // Server Object    : TLoginDemo
  105. // Help String      : LoginDemo Object
  106. // Default Interface: ILoginDemo
  107. // Def. Intf. DISP? : No
  108. // Event   Interface: 
  109. // TypeFlags        : (0)
  110. // *********************************************************************//
  111.   TLoginDemo = class(TOleServer)
  112.   private
  113.     FIntf:        ILoginDemo;
  114.     function      GetDefaultInterface: ILoginDemo;
  115.  
  116.   protected
  117.     procedure InitServerData; override;
  118.   public
  119.     procedure Connect; override;
  120.     procedure Disconnect; override;
  121.   // --------------
  122.   // --------------
  123.     function  AS_ApplyUpdates(const ProviderName: WideString; Delta: OleVariant; 
  124.                               MaxErrors: Integer; out ErrorCount: Integer; var OwnerData: OleVariant): OleVariant;
  125.     function  AS_GetRecords(const ProviderName: WideString; Count: Integer; out RecsOut: Integer; 
  126.                             Options: Integer; const CommandText: WideString; 
  127.                             var Params: OleVariant; var OwnerData: OleVariant): OleVariant;
  128.     function  AS_DataRequest(const ProviderName: WideString; Data: OleVariant): OleVariant;
  129.     function  AS_GetProviderNames: OleVariant;
  130.     function  AS_GetParams(const ProviderName: WideString; var OwnerData: OleVariant): OleVariant;
  131.     function  AS_RowRequest(const ProviderName: WideString; Row: OleVariant; RequestType: Integer; 
  132.                             var OwnerData: OleVariant): OleVariant;
  133.     procedure AS_Execute(const ProviderName: WideString; const CommandText: WideString; 
  134.                          var Params: OleVariant; var OwnerData: OleVariant);
  135.     procedure Login(const UserName: WideString; const Password: WideString);
  136.   // --------------
  137.     property  DefaultInterface: ILoginDemo read GetDefaultInterface;
  138.   // --------------
  139.   // --------------
  140.   // --------------
  141.   // --------------
  142.   published
  143.   end;
  144.  
  145. procedure Register;
  146.  
  147. implementation
  148.  
  149. uses ComObj;
  150.  
  151. class function CoLoginDemo.Create: ILoginDemo;
  152. begin
  153.   Result := CreateComObject(CLASS_LoginDemo) as ILoginDemo;
  154. end;
  155.  
  156. class function CoLoginDemo.CreateRemote(const MachineName: string): ILoginDemo;
  157. begin
  158.   Result := CreateRemoteComObject(MachineName, CLASS_LoginDemo) as ILoginDemo;
  159. end;
  160.  
  161. procedure TLoginDemo.InitServerData;
  162. const
  163.   CServerData: TServerData = (
  164.     ClassID: '{5E6A5BD5-F709-11D1-AABE-00C04FA35CFA}';
  165.     EventIID: '';
  166.     LicenseKey: nil;
  167.     Version: 401);
  168.  
  169. begin
  170.   ServerData := @CServerData;
  171. end;
  172.  
  173. procedure TLoginDemo.Connect;
  174. begin
  175.   if FIntf = nil then
  176.   begin
  177.     FIntf := CoLoginDemo.Create;
  178.   end;
  179. end;
  180.  
  181. procedure TLoginDemo.DisConnect;
  182. begin
  183.   FIntf := nil;
  184. end;
  185.  
  186.  
  187. function TLoginDemo.GetDefaultInterface: ILoginDemo;
  188. begin
  189.   Connect;
  190.   Result := FIntf;
  191. end;
  192.  
  193. function  TLoginDemo.AS_ApplyUpdates(const ProviderName: WideString; Delta: OleVariant; 
  194.                                      MaxErrors: Integer; out ErrorCount: Integer; 
  195.                                      var OwnerData: OleVariant): OleVariant;
  196. begin
  197.   Result := DefaultInterface.AS_ApplyUpdates(ProviderName, Delta, MaxErrors, ErrorCount, OwnerData);
  198. end;
  199.  
  200. function  TLoginDemo.AS_GetRecords(const ProviderName: WideString; Count: Integer; 
  201.                                    out RecsOut: Integer; Options: Integer; 
  202.                                    const CommandText: WideString; var Params: OleVariant; 
  203.                                    var OwnerData: OleVariant): OleVariant;
  204. begin
  205.   Result := DefaultInterface.AS_GetRecords(ProviderName, Count, RecsOut, Options, CommandText, 
  206.                                            Params, OwnerData);
  207. end;
  208.  
  209. function  TLoginDemo.AS_DataRequest(const ProviderName: WideString; Data: OleVariant): OleVariant;
  210. begin
  211.   Result := DefaultInterface.AS_DataRequest(ProviderName, Data);
  212. end;
  213.  
  214. function  TLoginDemo.AS_GetProviderNames: OleVariant;
  215. begin
  216.   Result := DefaultInterface.AS_GetProviderNames;
  217. end;
  218.  
  219. function  TLoginDemo.AS_GetParams(const ProviderName: WideString; var OwnerData: OleVariant): OleVariant;
  220. begin
  221.   Result := DefaultInterface.AS_GetParams(ProviderName, OwnerData);
  222. end;
  223.  
  224. function  TLoginDemo.AS_RowRequest(const ProviderName: WideString; Row: OleVariant; 
  225.                                    RequestType: Integer; var OwnerData: OleVariant): OleVariant;
  226. begin
  227.   Result := DefaultInterface.AS_RowRequest(ProviderName, Row, RequestType, OwnerData);
  228. end;
  229.  
  230. procedure TLoginDemo.AS_Execute(const ProviderName: WideString; const CommandText: WideString; 
  231.                                 var Params: OleVariant; var OwnerData: OleVariant);
  232. begin
  233.   DefaultInterface.AS_Execute(ProviderName, CommandText, Params, OwnerData);
  234. end;
  235.  
  236. procedure TLoginDemo.Login(const UserName: WideString; const Password: WideString);
  237. begin
  238.   DefaultInterface.Login(UserName, Password);
  239. end;
  240.  
  241. procedure Register;
  242. begin
  243.   RegisterComponents('Servers',[TLoginDemo]);
  244. end;
  245.  
  246. end.
  247.