首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

三层服务器 remote Data Module 生成的 *TLB.pas 文件有关问题 请下

2012-02-19 
三层服务器 remote Data Module 生成的 *_TLB.pas 文件问题 请高手指点下我新建了一个 remote Data module

三层服务器 remote Data Module 生成的 *_TLB.pas 文件问题 请高手指点下
我新建了一个 remote Data module 系统就自动生成了 **_TLB.pas 文件.

为什么我在**_TLB.pas 的接口里面定义自已的函数,保存了又就跟原来生成的一样了?

在网上找了半天还是没找到答案,请高手帮心啊!

例如

unit ScktSrvr_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 : 1.2
// File generated on 2007-9-5 9:39:50 from Type Library described below.

// ************************************************************************ //
// Type Lib: F:\wfl\myServer\ScktSrvr.tlb (1)
// LIBID: {10F8A33B-B5E0-4D8C-ADCE-D4A36D1E94DC}
// LCID: 0
// Helpfile: 
// HelpString: ScktSrvr Library
// DepndLst: 
// (1) v1.0 Midas, (C:\WINDOWS\system32\midas.dll)
// (2) v2.0 stdole, (C:\WINDOWS\system32\stdole2.tlb)
// ************************************************************************ //
{$TYPEDADDRESS OFF} // Unit must be compiled without type-checked pointers. 
{$WARN SYMBOL_PLATFORM OFF}
{$WRITEABLECONST ON}
{$VARPROPSETTER ON}
interface

uses Windows, ActiveX, Classes, Graphics, Midas, StdVCL, Variants;
  

// *********************************************************************//
// 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
  ScktSrvrMajorVersion = 1;
  ScktSrvrMinorVersion = 0;

  LIBID_ScktSrvr: TGUID = '{10F8A33B-B5E0-4D8C-ADCE-D4A36D1E94DC}';

  IID_Itest: TGUID = '{234031C4-60C2-4601-9F41-191E27FCF18A}';
  CLASS_test: TGUID = '{ABEB10B2-3060-4F79-8519-EBA88500E20E}';
type

// *********************************************************************//
// Forward declaration of types defined in TypeLibrary  
// *********************************************************************//
  Itest = interface;
  ItestDisp = dispinterface;

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


// *********************************************************************//
// Interface: Itest
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {234031C4-60C2-4601-9F41-191E27FCF18A}
// *********************************************************************//
  Itest = interface(IAppServer)
  ['{234031C4-60C2-4601-9F41-191E27FCF18A}']



  procedure test()safecall; //自已定义的方法

  end;

// *********************************************************************//
// DispIntf: ItestDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {234031C4-60C2-4601-9F41-191E27FCF18A}
// *********************************************************************//
  ItestDisp = dispinterface
  ['{234031C4-60C2-4601-9F41-191E27FCF18A}']

  procedure test(); //自已定义的方法



  function AS_ApplyUpdates(const ProviderName: WideString; Delta: OleVariant; MaxErrors: Integer; 
  out ErrorCount: Integer; var OwnerData: OleVariant): OleVariant; dispid 20000000;
  function AS_GetRecords(const ProviderName: WideString; Count: Integer; out RecsOut: Integer; 
  Options: Integer; const CommandText: WideString; var Params: OleVariant; 
  var OwnerData: OleVariant): OleVariant; dispid 20000001;
  function AS_DataRequest(const ProviderName: WideString; Data: OleVariant): OleVariant; dispid 20000002;
  function AS_GetProviderNames: OleVariant; dispid 20000003;
  function AS_GetParams(const ProviderName: WideString; var OwnerData: OleVariant): OleVariant; dispid 20000004;
  function AS_RowRequest(const ProviderName: WideString; Row: OleVariant; RequestType: Integer; 
  var OwnerData: OleVariant): OleVariant; dispid 20000005;
  procedure AS_Execute(const ProviderName: WideString; const CommandText: WideString; 
  var Params: OleVariant; var OwnerData: OleVariant); dispid 20000006;
  end;

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

implementation

uses ComObj;

class function Cotest.Create: Itest;
begin
  Result := CreateComObject(CLASS_test) as Itest;
end;

class function Cotest.CreateRemote(const MachineName: string): Itest;
begin
  Result := CreateRemoteComObject(MachineName, CLASS_test) as Itest;
end;

end.

我保存后就又成了刚创建的样子了

定义的 procedure test() 就没有了!
??????

[解决办法]
应该在类型库的面板中定义后保存,而不是直接修改pas文件

热点排行