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

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