delphi7:delphi7中手工建立cbx的xo工程

主要用于没有使用clxbase7集成开发环境cbx应用开发者



1、 在普通delphi7中建立xo首先是打开file -> ,选择dll wizard,新建个dll修改dpr内容如下



library adosvr; //这个名称就是xo名称



uses
SysUtils,
Classes;



begin

end.



2、然后加入xo祖先单元uEntityRoot in '..\..\..\CBX\Apps\Units\uEntityRoot.pas' {EntityRoot: TDataModule}代码就成了
library xodemo;



uses
SysUtils,
Classes,
uEntityRoot in '..\..\CBX\Apps\Units\uEntityRoot.pas' {EntityRoot: TDataModule};

{$E xo}

begin
end.

3、创建xo核心模块demoxo,file-> ->other 选xodemo页选EntityRoot,继承这个单元并命名为xoado我要使用ado数据连接组件故这样命名同时修改窗口名为demoxo ,这个名称是在ao中时ro组件中要设置服务名注意这个名称定要记住修改project options runtime packages 选择 build with runtime packagesadd d:\cbx\sdk\lib\AppSvrRT.dcp ,设置search path D:\CBX\SDK\Lib ,设置 output direxctory D:\CBX\SDK\__Deploy 到这里xo设置工作就完成了

4、修改 xoado单元代码

unit xoado;

erface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, uEntityRoot, HTTPApp;

type
Tdemoxo = (TEntityRoot)
procedure DataModuleCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
demoxo: Tdemoxo;

implementation

{$R *.dfm}

procedure Tdemoxo.DataModuleCreate(Sender: TObject);
begin
inherited;

end;

end.
以上是生成代码在xo中需要进行改造修改后代码如下

unit xoado;

erface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, uEntityRoot, HTTPApp;

type
Tdemoxo = (TEntityRoot)
procedure DataModuleCreate(Sender: TObject);
private
protected
function GetLocalData: TEntityLocalData; override;
public
procedure InitEntity(SubKey: eger; Data: ); override;
end;


function GetModClass: TEntityClass;
implementation
exports
GetModClass;
var

LocalData: TEntityLocalData;
function GetModClass: TEntityClass;
begin
Result := Tdemoxo;
end;
{$R *.dfm}

function Tdemoxo.GetLocalData: TEntityLocalData;
begin
Result := LocalData;
end;

procedure Tdemoxo.InitEntity(SubKey: eger; Data: );
begin
inherited;
end;

initialization
Tdemoxo.CreateLocalData(LocalData);

finalization
FreeAndNil(LocalData);

end.
5、在xodemo窗口增加数据库连接组件和 dataprovider 增加完后个最简单xo就算完成了

编译后使用console发布到cbx应用服务器
Tags:  delphi7序列号 delphi7注册码 delphi7教程 delphi7

延伸阅读

最新评论

发表评论