Intraweb 5.1.22写的程序如何转换到Intraweb6.x?(100分)

  • 主题发起人 主题发起人 Minor
  • 开始时间 开始时间
M

Minor

Unregistered / Unconfirmed
GUEST, unregistred user!
我在5.1.22上写的isapi程序在6.x上不能编译通过,如何改动,请分享经验,thanks!
 
工程文件末尾部分要有如下代码
{$R *.res}

begin
Application.Initialize;
Application.CreateForm(TformIWMain, formIWMain);
Application.Run;
end.
工程文件USE段要加入 IWMain单元
主窗体末尾部分要有如下代码
initialization
TfrmMain.SetAsMainForm;//frmMain为你的主窗体名。
 
到51delphi.com看哈,斑竹的intraweb水平高哦
 
sunsong,你说的是exe工程的修改方法,我的是DLL的工程。再请教::
 
Changes required when upgrading from 5.1 to 6.0:

The BGColor property
For easier and intuitive usage, the BackgroundColor properties of the form (TIWForm) and of the grid cells of dynamic grid (TIWDynGrid) have been renamed to BGColor. The BGColor name has been chosen as it's used for background colors throughout the components of IntraWeb.
When loading forms the contents of the old BackgroundColor property will be lost, and you'll have to set the desired color again in the BGColor property. Same thing applies when loading forms that contain TIWDynGrid controls.

ISAPI Projects
This change was introduced in the late stages of 5.1. For new applications, the wizard will automatically create the correct DPR omatically. However, for existing projects, you need to add the following code to your DPR file (highlighted with bold):

ISAPIApp,
IWInitISAPI,
ServerController in 'ServerController.pas' {IWServerController: TIWServerController},
Unit1 in 'Unit1.pas' {IWForm1: TIWFormModuleBase};

{$R *.RES}


exports
GetExtensionVersion,
HttpExtensionProc,
TerminateExtension;


Frames
You need to convert existing TFrame forms to IntraWeb frames. To do so, create a new IntraWeb Frame using the project wizard and then cut and paste your components on the new frame.


Changes required when upgrading from 5.0 to 5.1:

Whenever possible interfaces have remained the same. However is some situations it was deemed better to change interfaces for future expansion.

For the most part migrating from a 5.0 application to 5.1 is straightforward and this section is designed to assist you with this migration.

URLBase
To use URLBase, you need to access it via WebApplication.URLBase

TIWImage
The UseBorder property has been deprecated. The new BorderOptions property should be used instead.

RWebApplication
RWebApplication is now simply WebApplication. Scope determines whether this threadvar version or the property version is accessed.

Project Files
The project files have a new format and standalone debug executables are now seperate projects from the standalone service executables. Examples of each can be seen by looking at the Guess demo.

A new Standalone project file should look like this:

program Guess;

uses
Forms,
IWMain,
Main in 'Main.pas' {formMain: TIWFormModuleBase},
ServerController in 'ServerController.pas' {IWServerController: TDataModule};

{$R *.res}


begin
Application.Initialize;
Application.CreateForm(TFormIWMain, formIWMain);
Application.Run;
end.

When converting Service applications, you need to add IWInitService to the uses clause of the DPR and replace the existing code with:

program GuessService;

uses
IWInitService,
Main in 'Main.pas' {formMain: TIWFormModuleBase},
ServerController in 'ServerController.pas' {IWServerController: TDataModule};

{$R *.res}

begin

IWRun;
end.


ISAPI and DSO projects have the following layout (DPR file):

library GuessDLL;

uses
IWInitISAPI,
Main in 'Main.pas' {formMain: TIWFormModuleBase},
ServerController in 'ServerController.pas' {IWServerController: TDataModule};

{$R *.RES}

begin
IWRun;
end.


library GuessDSO;

uses
ApacheApp,
IWInitApache,
ServerController in 'ServerController.pas' {IWServerController:
TIWServerControllerBase},

Main in 'Main.pas' {formMain: TIWFormModuleBase};

{$R *.res}

exports
apache_module name 'GuessDSO_module';

begin
IWRun;
end.

When compiling for Apache 2, you need to make sure that you include IWInitApacheTwo in the uses clause as opposed to IWInitApache. If you create an Apache 2 application using the wizard, this is automatic.

NOTE: You need to make the appropriate changes to the Delphi 7 VCL before your modules will work with Apache 2. This information can be obtained on Dr. Bob's website at http://www.drbob42.com/Delphi7/Apache2040.htm

Setting the main form and server controller
For all types of projects (Standalone, ISAPI, DSO, Service), two initialization sections have to be added. The first one should be in the Main form of the project and indicates which form is the main form. For example, for the Guess project this would be:

initialization
TformMain.SetAsMainForm;

SetAsMainForm is a class procedure of a TIWForm. When working on projects that support both HTML 4.0 and PDA (HTML 3.2), it is VERY IMPORTANT that both the main form for the 4.0 version and the 3.2 version each have an initialization section indicating that it is the main form (see GuessMulti for examples).

The other initialization section is in regard to the server controller. This has to be set in the ServerController itself and it is present for new projects:

initialization
TIWServerController.SetServerControllerClass;

Here SetServerControllerClass is again a class procedure of IWServerControllerBase.

OnNewSession
The OnNewSession event handler has a change in the signature. The new signature is:

OnNewSession(ASession: TIWApplication; var VMainForm: TIWBaseForm);

Be sure to include IWBaseForm and IWBaseControl in the uses clause of the ServerController if converting from a previous version.

Session and DataModule Owners
In previous versions (prior to 5.1), the session owner would be ASession and then DataModule owner (if present) would be AOwner. In 5.1, these have changed to nil for the first and Self for the latter.

Deprecated properties on forms
It is recommendable that when you open a previously made project in versions prior to 5.1, you go through all the
forms and ignore any non-existent properties, before compiling your application.

TemplateProcessor property
This property has been renamed to LayoutMgr. Assign any TemplateProcessor components on your form to this
new property

Application Path

In previous versions of IW, you needed to use gsAppPath to obtain the application path. From 5.1 you can use WebApplication.ApplicationPath to obtain this.
 
后退
顶部