在Remote data module模块中能使用Constructor(构造函数)吗?

riccdw421 2007-08-13 10:43:42
代码如下:
unit RDM;

{$WARN SYMBOL_PLATFORM OFF}

interface

uses
Windows, Messages, SysUtils, Classes, ComServ, ComObj, VCLCom, DataBkr,
DBClient, GP50Server_TLB, StdVcl, DBTables, Provider, DB;

type
TGP50RDM = class(TRemoteDataModule, IGP50RDM)
...
private
{ Private declarations }
protected
class procedure UpdateRegistry(Register: Boolean; const ClassID, ProgID: string); override;
public
{ Public declarations }
//第一种:按照系统的原型或不带参数:
//编译时[Error] RDM.pas(205): Declaration of 'Create' differs from previous declaration //好像说的意思是:"说明与先前的说明不同"
Constructor Create(ComServer:TComServerObject;CompentClass:TComponentClass;Const ClassID:TGUID;Instancing:TClassInstancing;ThreadingModel:TThreadingModel); override;
Constructor Create();override;
//第二种:
//编译时:[Error] Main.pas(16): Unsatisfied forward or external declaration: 'TForm1.create'//好像说的意思是:"不满足的向前或外部说明"
constructor create(TOwner:TComponent);override;

end;

...
implementation

{$R *.DFM}

....
initialization
//--定义的原型:--加入Remote date module时,系统自动创建的,只不过我把它贴出来

{
TComponentFactory.Create:proceduce
(ComServer:TComServerObject;CompentClass:TComponentClass;
Const ClassID:TGUID;Instancing:TClassInstancing;ThreadingModel:TThreadingModel=tmSingle);
}
//--加入Remote date module时,系统自动创建的
TComponentFactory.Create(ComServer, TGP50RDM,
Class_GP50RDM, ciMultiInstance, tmApartment);
end.

说明:我想要的结果是调用Remote data module模块时.通过构造器来实现读取ini配置文件.ini文件中存有数据库登陆名和密码.
不知道这样子实现有没有问题,或者是有更好的方法,请各位指点指点...
...全文
124 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
brightyang 2007-08-13
  • 打赏
  • 举报
回复
行不行试试不就知道了
riccdw421 2007-08-13
  • 打赏
  • 举报
回复
试过:我都在上面代码中有,就是不知道这声明怎么搞得,就是不行.
而且我也试过用onCreate,onDestroy事件来处理,不知道效果是一样的不?
在这个试的过程遇到过一个问题是:
ExtractFilePath(Application.ExeName)来获取路径时,一放在Remote data modul这个onCreate,onDestroy事件中Application根本没有ExeName这个属性,在Form窗体中是可以的.

1,594

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 网络通信/分布式开发
社区管理员
  • 网络通信/分布式开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧