AppServ1_TLB.pas
上传用户:fh681027
上传日期:2022-07-23
资源大小:1959k
文件大小:13k
源码类别:

Delphi控件源码

开发平台:

Delphi

  1. unit AppServ1_TLB;
  2. // ************************************************************************ //
  3. // WARNING                                                                    
  4. // -------                                                                    
  5. // The types declared in this file were generated from data read from a       
  6. // Type Library. If this type library is explicitly or indirectly (via        
  7. // another type library referring to this type library) re-imported, or the   
  8. // 'Refresh' command of the Type Library Editor activated while editing the   
  9. // Type Library, the contents of this file will be regenerated and all        
  10. // manual modifications will be lost.                                         
  11. // ************************************************************************ //
  12. // PASTLWTR : $Revision:   1.81  $
  13. // File generated on 8/4/99 10:13:12 AM from Type Library described below.
  14. // *************************************************************************//
  15. // NOTE:                                                                      
  16. // Items guarded by $IFDEF_LIVE_SERVER_AT_DESIGN_TIME are used by properties  
  17. // which return objects that may need to be explicitly created via a function 
  18. // call prior to any access via the property. These items have been disabled  
  19. // in order to prevent accidental use from within the object inspector. You   
  20. // may enable them by defining LIVE_SERVER_AT_DESIGN_TIME or by selectively   
  21. // removing them from the $IFDEF blocks. However, such items must still be    
  22. // programmatically created via a method of the appropriate CoClass before    
  23. // they can be used.                                                          
  24. // ************************************************************************ //
  25. // Type Lib: C:md5codePart521AppServ1AppServ1.tlb (1)
  26. // IIDLCID: {09E11D60-4A55-11D3-B9F1-00000100A27B}
  27. // Helpfile: 
  28. // DepndLst: 
  29. //   (1) v2.0 stdole, (C:WINDOWSSYSTEMSTDOLE2.TLB)
  30. //   (2) v4.0 StdVCL, (C:WINDOWSSYSTEMSTDVCL40.DLL)
  31. //   (3) v1.0 Midas, (C:WINDOWSSYSTEMMIDAS.DLL)
  32. // ************************************************************************ //
  33. {$TYPEDADDRESS OFF} // Unit must be compiled without type-checked pointers. 
  34. interface
  35. uses Windows, ActiveX, Classes, Graphics, OleServer, OleCtrls, StdVCL, 
  36.   Midas;
  37. // *********************************************************************//
  38. // GUIDS declared in the TypeLibrary. Following prefixes are used:        
  39. //   Type Libraries     : LIBID_xxxx                                      
  40. //   CoClasses          : CLASS_xxxx                                      
  41. //   DISPInterfaces     : DIID_xxxx                                       
  42. //   Non-DISP interfaces: IID_xxxx                                        
  43. // *********************************************************************//
  44. const
  45.   // TypeLibrary Major and minor versions
  46.   AppServ1MajorVersion = 1;
  47.   AppServ1MinorVersion = 0;
  48.   LIBID_AppServ1: TGUID = '{09E11D60-4A55-11D3-B9F1-00000100A27B}';
  49.   IID_IAppServerOne: TGUID = '{09E11D61-4A55-11D3-B9F1-00000100A27B}';
  50.   CLASS_AppServerOne: TGUID = '{09E11D63-4A55-11D3-B9F1-00000100A27B}';
  51. type
  52. // *********************************************************************//
  53. // Forward declaration of types defined in TypeLibrary                    
  54. // *********************************************************************//
  55.   IAppServerOne = interface;
  56.   IAppServerOneDisp = dispinterface;
  57. // *********************************************************************//
  58. // Declaration of CoClasses defined in Type Library                       
  59. // (NOTE: Here we map each CoClass to its Default Interface)              
  60. // *********************************************************************//
  61.   AppServerOne = IAppServerOne;
  62. // *********************************************************************//
  63. // Interface: IAppServerOne
  64. // Flags:     (4416) Dual OleAutomation Dispatchable
  65. // GUID:      {09E11D61-4A55-11D3-B9F1-00000100A27B}
  66. // *********************************************************************//
  67.   IAppServerOne = interface(IAppServer)
  68.     ['{09E11D61-4A55-11D3-B9F1-00000100A27B}']
  69.   end;
  70. // *********************************************************************//
  71. // DispIntf:  IAppServerOneDisp
  72. // Flags:     (4416) Dual OleAutomation Dispatchable
  73. // GUID:      {09E11D61-4A55-11D3-B9F1-00000100A27B}
  74. // *********************************************************************//
  75.   IAppServerOneDisp = dispinterface
  76.     ['{09E11D61-4A55-11D3-B9F1-00000100A27B}']
  77.     function  AS_ApplyUpdates(const ProviderName: WideString; Delta: OleVariant; 
  78.                               MaxErrors: Integer; out ErrorCount: Integer; var OwnerData: OleVariant): OleVariant; dispid 20000000;
  79.     function  AS_GetRecords(const ProviderName: WideString; Count: Integer; out RecsOut: Integer; 
  80.                             Options: Integer; const CommandText: WideString; 
  81.                             var Params: OleVariant; var OwnerData: OleVariant): OleVariant; dispid 20000001;
  82.     function  AS_DataRequest(const ProviderName: WideString; Data: OleVariant): OleVariant; dispid 20000002;
  83.     function  AS_GetProviderNames: OleVariant; dispid 20000003;
  84.     function  AS_GetParams(const ProviderName: WideString; var OwnerData: OleVariant): OleVariant; dispid 20000004;
  85.     function  AS_RowRequest(const ProviderName: WideString; Row: OleVariant; RequestType: Integer; 
  86.                             var OwnerData: OleVariant): OleVariant; dispid 20000005;
  87.     procedure AS_Execute(const ProviderName: WideString; const CommandText: WideString; 
  88.                          var Params: OleVariant; var OwnerData: OleVariant); dispid 20000006;
  89.   end;
  90. // *********************************************************************//
  91. // The Class CoAppServerOne provides a Create and CreateRemote method to          
  92. // create instances of the default interface IAppServerOne exposed by              
  93. // the CoClass AppServerOne. The functions are intended to be used by             
  94. // clients wishing to automate the CoClass objects exposed by the         
  95. // server of this typelibrary.                                            
  96. // *********************************************************************//
  97.   CoAppServerOne = class
  98.     class function Create: IAppServerOne;
  99.     class function CreateRemote(const MachineName: string): IAppServerOne;
  100.   end;
  101. // *********************************************************************//
  102. // OLE Server Proxy class declaration
  103. // Server Object    : TAppServerOne
  104. // Help String      : AppServerOne Object
  105. // Default Interface: IAppServerOne
  106. // Def. Intf. DISP? : No
  107. // Event   Interface: 
  108. // TypeFlags        : (2) CanCreate
  109. // *********************************************************************//
  110. {$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  111.   TAppServerOneProperties= class;
  112. {$ENDIF}
  113.   TAppServerOne = class(TOleServer)
  114.   private
  115.     FIntf:        IAppServerOne;
  116. {$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  117.     FProps:       TAppServerOneProperties;
  118.     function      GetServerProperties: TAppServerOneProperties;
  119. {$ENDIF}
  120.     function      GetDefaultInterface: IAppServerOne;
  121.   protected
  122.     procedure InitServerData; override;
  123.   public
  124.     constructor Create(AOwner: TComponent); override;
  125.     destructor  Destroy; override;
  126.     procedure Connect; override;
  127.     procedure ConnectTo(svrIntf: IAppServerOne);
  128.     procedure Disconnect; override;
  129.     function  AS_ApplyUpdates(const ProviderName: WideString; Delta: OleVariant; 
  130.                               MaxErrors: Integer; out ErrorCount: Integer; var OwnerData: OleVariant): OleVariant;
  131.     function  AS_GetRecords(const ProviderName: WideString; Count: Integer; out RecsOut: Integer; 
  132.                             Options: Integer; const CommandText: WideString; 
  133.                             var Params: OleVariant; var OwnerData: OleVariant): OleVariant;
  134.     function  AS_DataRequest(const ProviderName: WideString; Data: OleVariant): OleVariant;
  135.     function  AS_GetProviderNames: OleVariant;
  136.     function  AS_GetParams(const ProviderName: WideString; var OwnerData: OleVariant): OleVariant;
  137.     function  AS_RowRequest(const ProviderName: WideString; Row: OleVariant; RequestType: Integer; 
  138.                             var OwnerData: OleVariant): OleVariant;
  139.     procedure AS_Execute(const ProviderName: WideString; const CommandText: WideString; 
  140.                          var Params: OleVariant; var OwnerData: OleVariant);
  141.     property  DefaultInterface: IAppServerOne read GetDefaultInterface;
  142.   published
  143. {$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  144.     property Server: TAppServerOneProperties read GetServerProperties;
  145. {$ENDIF}
  146.   end;
  147. {$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  148. // *********************************************************************//
  149. // OLE Server Properties Proxy Class
  150. // Server Object    : TAppServerOne
  151. // (This object is used by the IDE's Property Inspector to allow editing
  152. //  of the properties of this server)
  153. // *********************************************************************//
  154.  TAppServerOneProperties = class(TPersistent)
  155.   private
  156.     FServer:    TAppServerOne;
  157.     function    GetDefaultInterface: IAppServerOne;
  158.     constructor Create(AServer: TAppServerOne);
  159.   protected
  160.   public
  161.     property DefaultInterface: IAppServerOne read GetDefaultInterface;
  162.   published
  163.   end;
  164. {$ENDIF}
  165. procedure Register;
  166. implementation
  167. uses ComObj;
  168. class function CoAppServerOne.Create: IAppServerOne;
  169. begin
  170.   Result := CreateComObject(CLASS_AppServerOne) as IAppServerOne;
  171. end;
  172. class function CoAppServerOne.CreateRemote(const MachineName: string): IAppServerOne;
  173. begin
  174.   Result := CreateRemoteComObject(MachineName, CLASS_AppServerOne) as IAppServerOne;
  175. end;
  176. procedure TAppServerOne.InitServerData;
  177. const
  178.   CServerData: TServerData = (
  179.     ClassID:   '{09E11D63-4A55-11D3-B9F1-00000100A27B}';
  180.     IntfIID:   '{09E11D61-4A55-11D3-B9F1-00000100A27B}';
  181.     EventIID:  '';
  182.     LicenseKey: nil;
  183.     Version: 500);
  184. begin
  185.   ServerData := @CServerData;
  186. end;
  187. procedure TAppServerOne.Connect;
  188. var
  189.   punk: IUnknown;
  190. begin
  191.   if FIntf = nil then
  192.   begin
  193.     punk := GetServer;
  194.     Fintf:= punk as IAppServerOne;
  195.   end;
  196. end;
  197. procedure TAppServerOne.ConnectTo(svrIntf: IAppServerOne);
  198. begin
  199.   Disconnect;
  200.   FIntf := svrIntf;
  201. end;
  202. procedure TAppServerOne.DisConnect;
  203. begin
  204.   if Fintf <> nil then
  205.   begin
  206.     FIntf := nil;
  207.   end;
  208. end;
  209. function TAppServerOne.GetDefaultInterface: IAppServerOne;
  210. begin
  211.   if FIntf = nil then
  212.     Connect;
  213.   Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
  214.   Result := FIntf;
  215. end;
  216. constructor TAppServerOne.Create(AOwner: TComponent);
  217. begin
  218.   inherited Create(AOwner);
  219. {$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  220.   FProps := TAppServerOneProperties.Create(Self);
  221. {$ENDIF}
  222. end;
  223. destructor TAppServerOne.Destroy;
  224. begin
  225. {$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  226.   FProps.Free;
  227. {$ENDIF}
  228.   inherited Destroy;
  229. end;
  230. {$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  231. function TAppServerOne.GetServerProperties: TAppServerOneProperties;
  232. begin
  233.   Result := FProps;
  234. end;
  235. {$ENDIF}
  236. function  TAppServerOne.AS_ApplyUpdates(const ProviderName: WideString; Delta: OleVariant; 
  237.                                         MaxErrors: Integer; out ErrorCount: Integer; 
  238.                                         var OwnerData: OleVariant): OleVariant;
  239. begin
  240.   Result := DefaultInterface.AS_ApplyUpdates(ProviderName, Delta, MaxErrors, ErrorCount, OwnerData);
  241. end;
  242. function  TAppServerOne.AS_GetRecords(const ProviderName: WideString; Count: Integer; 
  243.                                       out RecsOut: Integer; Options: Integer; 
  244.                                       const CommandText: WideString; var Params: OleVariant; 
  245.                                       var OwnerData: OleVariant): OleVariant;
  246. begin
  247.   Result := DefaultInterface.AS_GetRecords(ProviderName, Count, RecsOut, Options, CommandText, 
  248.                                            Params, OwnerData);
  249. end;
  250. function  TAppServerOne.AS_DataRequest(const ProviderName: WideString; Data: OleVariant): OleVariant;
  251. begin
  252.   Result := DefaultInterface.AS_DataRequest(ProviderName, Data);
  253. end;
  254. function  TAppServerOne.AS_GetProviderNames: OleVariant;
  255. begin
  256.   Result := DefaultInterface.AS_GetProviderNames;
  257. end;
  258. function  TAppServerOne.AS_GetParams(const ProviderName: WideString; var OwnerData: OleVariant): OleVariant;
  259. begin
  260.   Result := DefaultInterface.AS_GetParams(ProviderName, OwnerData);
  261. end;
  262. function  TAppServerOne.AS_RowRequest(const ProviderName: WideString; Row: OleVariant; 
  263.                                       RequestType: Integer; var OwnerData: OleVariant): OleVariant;
  264. begin
  265.   Result := DefaultInterface.AS_RowRequest(ProviderName, Row, RequestType, OwnerData);
  266. end;
  267. procedure TAppServerOne.AS_Execute(const ProviderName: WideString; const CommandText: WideString; 
  268.                                    var Params: OleVariant; var OwnerData: OleVariant);
  269. begin
  270.   DefaultInterface.AS_Execute(ProviderName, CommandText, Params, OwnerData);
  271. end;
  272. {$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  273. constructor TAppServerOneProperties.Create(AServer: TAppServerOne);
  274. begin
  275.   inherited Create;
  276.   FServer := AServer;
  277. end;
  278. function TAppServerOneProperties.GetDefaultInterface: IAppServerOne;
  279. begin
  280.   Result := FServer.DefaultInterface;
  281. end;
  282. {$ENDIF}
  283. procedure Register;
  284. begin
  285.   RegisterComponents('Servers',[TAppServerOne]);
  286. end;
  287. end.