Delphi XE IntraWeb XI Development

更新时间:2023-04-11 02:57:01 阅读量: 实用文档 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

Delphi XE IntraWeb XI Development

Delphi XE, IntraWeb XI (VCL for the Web)

1th EDITION for Bob Swart

Bob Swart (aka Dr.Bob)

Bob Swart Training & Consultancy (eBob42)

5555bf582af90242a895e5d4

Delphi Win32 Web Development

Bob Swart (Bob@5555bf582af90242a895e5d4 ) - ii - February 2011 Table of Contents

1. VCL for the Web / IntraWeb XI .................................................1 IntraWeb XI 11.x and Delphi XE ..........................................................1 IDE Support.............................................................................1 Discontinued Features ..............................................................1 IntraWeb XI Features ...............................................................2 Uninstall Previous Version.........................................................3 Installing IntraWeb XI ..............................................................5 IntraWeb License Keys..............................................................11 Summary (12)

2. IntraWeb XI Applications (13)

IWDemo Project Source......................................................................14 GUI Mode................................................................................15 Service Mode...........................................................................16 Server Controller................................................................................17 TIWServerController Properties..................................................19 AllowMultipleSessionsPerUser....................................................20 AppName ................................................................................20 AuthBeforeNewSession .............................................................20 Auther ....................................................................................20 BoundIP..................................................................................22 CacheDir.................................................................................22 CacheExpiry ............................................................................22 CharSet...................................................................................22 ComInitialization......................................................................22 Compression............................................................................22 ContentFiles ............................................................................23 DebugHTML.............................................................................24 Description..............................................................................24 DisplayName ...........................................................................24 EnableImageToolbar.................................................................24 ExceptionDisplayMode ..............................................................24 FilesDir ...................................................................................24 HistoryEnabled.........................................................................24 HTMLHeaders...........................................................................24 InternalFilesDir........................................................................24 InternalFilesURL.......................................................................25 JavascriptDebug.......................................................................25 Log.........................................................................................25 MasterTemplate .......................................................................25 PageTransitions........................................................................25 Port........................................................................................25 RedirectMsgDelay.....................................................................25 ServerResizeTimeout................................................................26 SessionTimeout........................................................................26 ShowLoadingAnimation.............................................................26 SSLOptions..............................................................................26 StyleSheet ..............................................................................26 TemplateDir.............................................................................26 TimeoutResponse.....................................................................26 TIWServerController Events ................................................................27 OnAfterDispatch.......................................................................27 OnAfterRender. (27)

Delphi Win32 Web Development

Bob Swart Training & Consultancy - iii - 5555bf582af90242a895e5d4 OnBackButton..........................................................................27 OnBeforeDispatch.....................................................................28 OnBeforeRender.......................................................................28 OnCloseSession........................................................................28 OnException............................................................................28 OnGetSessionID.......................................................................29 OnNewSession.........................................................................29 IntraWeb TIWApplication Properties .....................................................29 ActiveForm..............................................................................30 ActiveFormCount......................................................................30 AppID.....................................................................................30 ApplicationURL.........................................................................30 Browser ..................................................................................30 Data .......................................................................................30 FormAction..............................................................................30 FormCount ..............................................................................30 Forms.....................................................................................30 IP...........................................................................................30 IsCallback ...............................................................................30 LastAccess...............................................................................30 RedirectURL.............................................................................30 ReferringURL ...........................................................................31 Request ..................................................................................31 Response ................................................................................31 RunParams..............................................................................31 SecureMode.............................................................................31 SessionTimeout........................................................................31 Terminated..............................................................................31 TerminateMessage ...................................................................31 TerminateURL..........................................................................31 TrackID...................................................................................31 UserCacheDir...........................................................................32 TIWApplication Methods......................................................................32 GoToURL.................................................................................32 MarkAccess..............................................................................32 SendFile..................................................................................32 SendStream ............................................................................32 ShowMessage..........................................................................32 Terminate ...............................................................................33 TerminateAndRedirect ..............................................................33 TIWAppForm......................................................................................33 IntraWeb TIWPageForm......................................................................33 ActiveControl...........................................................................35 Background.............................................................................35 ExtraHeader ............................................................................35 HandleTabs .............................................................................35 HiddenFields............................................................................35 JavaScript ...............................................................................35 LayoutMgr...............................................................................35 LinkColor.................................................................................35 ShowHint ................................................................................35 StyleSheet ..............................................................................35 SupportedBrowsers ..................................................................35 TextColor ................................................................................35 Title........................................................................................35 VLinkColor. (35)

Delphi Win32 Web Development

Bob Swart (Bob@5555bf582af90242a895e5d4 ) - iv - February 2011 TIWPageForm Events..........................................................................36 OnAfterRender.........................................................................36 OnCreate.................................................................................36 OnDefaultAction.......................................................................36 OnDestroy...............................................................................36 OnRender................................................................................36 Designing IntraWeb Page Form..................................................37 IW Standard Controls .........................................................................37 TIWApplet...............................................................................37 TIWButton...............................................................................38 TIWCheckBox ..........................................................................39 TIWComboBox.........................................................................40 TIWEdit...................................................................................41 TIWFile ...................................................................................41 TIWFlash.................................................................................41 TIWHRule................................................................................42 TIWImage...............................................................................42 TIWImageFile ..........................................................................42 TIWImageButton......................................................................42 TIWList ...................................................................................42 TIWLabel.................................................................................42 TIWListbox..............................................................................43 TIWLink ..................................................................................43 TIWMemo................................................................................44 TIWMenu.................................................................................44 TIWProgressBar .......................................................................44 TIWRadioGroup........................................................................45 TIWRectangle ..........................................................................45 TIWRegion...............................................................................45 TIWText..................................................................................45 TIWTimer................................................................................45 TIWGrid..................................................................................46 TIWTreeview ...........................................................................47 TIWTreeViewItem ....................................................................47 TIWURL...................................................................................47 TIWURLWindow........................................................................47 TIWMPeg.................................................................................47 TIWQuickTime .........................................................................47 TIWCalendar............................................................................47 Multiple IntraWeb Application Forms ....................................................48 Final Release ...........................................................................48 Passing Information Around ......................................................49 Getting Back............................................................................49 State Management.............................................................................50 UserSession.............................................................................50 Extending User Session.............................................................51 Using User Session...................................................................51 Summary (52)

3. IntraWeb and Databases...........................................................53 Data Module......................................................................................53 TSQLConnection.......................................................................54 TSQLDataSet...........................................................................55 IW Data Controls................................................................................56 TIWDBCheckBox ......................................................................56 TIWDBComboBox.....................................................................56 TIWDBEdit. (56)

Delphi Win32 Web Development

Bob Swart Training & Consultancy - v - 5555bf582af90242a895e5d4 TIWDBGrid..............................................................................56 TIWDBImage...........................................................................56 TIWDBLabel.............................................................................56 TIWDBListbox..........................................................................57 TIWDBLookupListbox................................................................57 TIWDBLookupCombobox ...........................................................57 TIWDBFile...............................................................................57 TIWDBMemo............................................................................57 TIWDBNavigator ......................................................................57 TIWDBText..............................................................................57 TIWDBRadioGroup....................................................................57 Continued Demo ................................................................................58 TIWDBGrid Usage.....................................................................62 Sharing VCL data modules with VCL for the Web ...................................67 Pool Data Connections ........................................................................68 DatamoduleUnit.......................................................................69 ServerController.......................................................................69 Using Data Pooling ...................................................................71 Custom Data Pooling ................................................................72 Summary (72)

4. IntraWeb and AJAX...................................................................73 AJAX = Asynchronous.........................................................................73 OnAsync..................................................................................73 OnAsync Events.......................................................................75 EventParams ...........................................................................76 Working with EventParams........................................................78 OnAsync and Visible.................................................................79 OnAsync and Disable................................................................79 Summary (80)

5. IntraWeb and iPhone / iPad......................................................81 TMS IntraWeb iPhone Controls Pack.....................................................81 TTIWiPhoneButton....................................................................83 TTIWiPhoneEmailLabel..............................................................83 TTIWiPhoneFooter....................................................................83 TTIWiPhoneGeolocation ............................................................84 TTIWiPhoneHeader...................................................................84 TTIWiPhoneList........................................................................84 TTIWiPhoneLocationLabel..........................................................84 TTIWiPhoneMenu .....................................................................84 TTIWiPhoneOnOffButton ...........................................................84 TTIWiPhonePageFlip .................................................................85 TTIWiPhonePhoneLabel.............................................................85 TTIWiPhoneRegion ...................................................................85 TTIWiPhoneScrollRegion............................................................85 TTIWiPhoneSMSLabel ...............................................................85 TTIWiPhoneStyle......................................................................85 TTIWiPhoneTrackbar.................................................................85 TMS iPhone Controls Demo..................................................................86 Registered Users......................................................................95 Summary (96)

6. IntraWeb Custom Components..................................................97 IntraWeb Controls..............................................................................97 Custom Components.................................................................99 Packages.................................................................................100 TIEuroComboBox (102)

Delphi Win32 Web Development

Bob Swart (Bob@5555bf582af90242a895e5d4 ) - vi - February 2011 TIWRequiredEdit......................................................................104 Installation and Usage..............................................................105 Summary (105)

7. IntraWeb Testing Framework....................................................107 Sample Application.............................................................................107 Manual Test.............................................................................108 VCL for the Web Test Project...............................................................109 Sharing Main Form...................................................................110 Writing Test Code.....................................................................110 More Tests...............................................................................117 ITestSuite .........................................................................................118 Summary (119)

8. IntraWeb Deployment...............................................................121 Project Targets...................................................................................121 StandAlone Application .............................................................121 Service Application...................................................................122 ISAPI Extension .......................................................................122 Multiple Project Targets ......................................................................122 Windows Server 2003.........................................................................123 Enabling ISAPI / CGI ................................................................123 Virtual Directory.......................................................................124 Deployment on Windows Server 2008 and IIS7.....................................127 IntraWeb Deployment.........................................................................132 Files, Templates and Cache.......................................................132 Database Drivers......................................................................132 DBX4 Drivers...........................................................................132 DBX Trace / Pool Connections....................................................133 Core Lab DBX4 Drivers..............................................................133 Summary (134)

The information in this courseware manual is ? 2001-2011 by drs. Robert E. (Bob) Swart of Bob Swart Training & Consultancy. All Rights Reserved.

The information in this courseware manual is presented to the best of my knowledge at the time of writing. However, in case of errors or omissions, I welcome your feedback or comments (by e-mail) as Bob Swart Training & Consultancy cannot be held responsible for any damage that results from using the information in this manual or the example source code snippets. Thanks in advance for your understanding.

Delphi Win32 Web Development

3. VCL for the Web / IntraWeb

Bob Swart Training & Consultancy - 1 - 5555bf582af90242a895e5d4 1. VCL for the Web / IntraWeb XI IntraWeb is a third-party product which has been included with Delphi since version 7, has been renamed to “VCL for the Web” since Delphi 2007, and offers a RAD way to build Win32 web applications, reusing data access components and data modules when needed. Including support for AJAX and custom controls, and third-party controls from TMS Software to build even web applications for the iPhone and iPad for example.

In this first section, I will cover how to correctly install IntraWeb XE on your machine and integrate it with your copy of Delphi. But we also examine the different editions and features of IntraWeb XI.

IntraWeb XI 11.x and Delphi XE

Since Delphi 7, IntraWeb ships as part of Delphi in the box. Delphi 7 came with IntraWeb 5.0 for example (and also included a free upgrade to IntraWeb 5.1 – but after that you had to purchase a license for further updates). Delphi XE comes with IntraWeb XI version 11.0.0 in the box. With Delphi XE Professional you get IntraWeb XI Personal, and with Delphi XE Enterprise you get IntraWeb XI Standard. Note that these are not the full “ultimate” versions of IntraWeb. Also, even if you want to keep using the bundled Personal or Standard version, it is strongly recommended to register yourself at the AtoZedSoftware website to get your free key which will entitle you to free updates of your edition of IntraWeb XI –not the major upgrades – and the bundled features, but not the full ultimate functionality.

See 5555bf582af90242a895e5d4/IntraWeb/FeatureMatrix.aspx for an overview of the features found in IntraWeb XI, which are also briefly summarised here.

IDE Support

IntraWeb XI is supported by Delphi 7, 2006, 2007, 2009, 2010 and Delphi XE:

Evaluation Personal Standard Ultimate

Supported Environments Delphi 7, 2006, 2007, 2009, 2010, XE Delphi 7, 2006, 2007, 2009, 2010, XE Delphi 7, 2006, 2007, 2009, 2010, XE Delphi 7, 2006, 2007, 2009, 2010, XE

Bundled With available as free download Delphi XE or RAD Studio XE Professional Delphi XE or RAD Studio XE Enterprise / Architect

only available as separate purchase See the above URL for pricing and special offers with regards to the Personal, Standard and Ultimate editions of IntraWeb XI. In this courseware manual, I will use Delphi XE Enterprise in combination with IntraWeb XI Ultimate.

Discontinued Features

For people who worked with previous versions of IntraWeb, it may be important to note the features and functionality which are no longer found in IntraWeb XI.

Page Mode has been deprecated, and replaced by Integrated Page Mode. Unfortunately, while Integrated Page Mode offers new capabilities, the “old” Page Mode options are no longer possible. So, if you have existing WebBroker Page Mode application using IntraWeb 10.x or lower, you may need to maintain them using the older version of IntraWeb (potentially on a different machine if you also want to use IntraWeb XI in the same version of Delphi).

Delphi Win32 Web Development 3. VCL for the Web / IntraWeb Bob Swart (Bob@5555bf582af90242a895e5d4 ) - 2 - February 2011 Support for WAP and HTML 3.2 is also removed from IntraWeb XI. As a result, there is now only one main form type: for HTML 4 and higher. If you still have WAP or HTML 3.2 web applications using IntraWeb 10.x or lower, you may need to maintain them using the older version of IntraWeb (potentially on a different machine if you also want to use IntraWeb XI in the same version of Delphi). To be honest, this feature is probably not used a lot anymore, as most mobile devices support a rich set of HTML, and we’ll see in the section on IntraWeb and iPhone / iPad development for example. As another consequence of this, support for older browser has also been removed from IntraWeb XI. The (minimum version of) supported browsers are as follows (no specific support for Opera exists anymore): - FireFox 3 - Internet Explorer 7 - Chrome, Safari The Client Side components, like Client Side DataSets Client Side Charts, and DynGrid have been removed from IntraWeb XI. These features are no longer used, and can be replaced with AJAX functionality. On a similar note, the feature using partial updates has been deprecated, and should be replaced with full use of AJAX now. AJAX support was introduced in IntraWeb 9.x, and there should be no use of umPartial – if you still use it, then just replace it by OnAsync event handlers instead for much better results. Support for Apache DSO files is discontinued for two reasons: first of all, Delphi hasn’t been offering Apache support in WebBroker Wizards for some time (although it’s unofficially still available in the source code units), and Apache can now run ISAPI DLLs so there is no need for special DSO support from IntraWeb. The session in IntraWeb application used to be tracking using the SessionID in the URL, a hidden field, or using a cookie (the tmURL, tmHidden and tmCookie options). IntraWeb XI will support cookies for session tracking, and this has also lead to the new feature called Integrated Page Mode and URL mapping. As a consequence of using cookies to track the session, it may no longer be possible to allow a single user to run multiple sessions in separate tabs or windows (since the cookie may be shared by these tabs). For this purpose, IntraWeb XI introduces the property AllowMultipleSessionsPerUser in the ServerController, which will ensure that each browser window or tab can have its own unique session cookie (so you can have multiple user sessions).

IntraWeb XI Features

The following table lists the features of IntraWeb and the four different editions.

Evaluation Personal

Standard Ultimate Standalone Server Deployment Yes Yes Yes Yes Service Deployment Yes Yes ISAPI Deployment Yes SSL Encryption Yes IP Binding Yes Priority Support Yes Access to (most) Source Code Yes Concurrent Session Limit 5 Application Mode Yes Yes Yes Yes XI Authentication Yes Yes Session Inactivity Timeout Config 20 mins 20 mind Config

Delphi Win32 Web Development

3. VCL for the Web / IntraWeb Bob Swart Training & Consultancy - 3 - 5555bf582af90242a895e5d4 Even if you use the bundled edition, you could decide to purchase IntraWeb XI Ultimate. For this courseware manual, I’ve used IntraWeb XI Ultimate version 11.0.32.

Uninstall Previous Version

Before you install the latest version of IntraWeb, you should make sure the bundled edition is uninstalled from Delphi (or not installed in the first place). If you are uncertain whether or not you included IntraWeb (VCL for the Web) in the installation of Delphi XE, or you installed it and need to remove it, then you can start the “Modify, Repair, Uninstall” item from the Embarcadero RAD Studio XE program group. This will call the C:\ProgramData\{7DE921C9-42C8-4DA3-8A44-043C3349FD1D}\Setup.exe and present you with the RAD Studio XE Maintenance dialog. Here, you can select Modify in order to modify the existing installation:

Click on Next, and after you’ve selected Delphi XE (and optionally C++Builder XE if your serial number also enabled that) in the second page, you can click on Next again to enter the third page of the wizard where you can select the languages that will be installed on your machine. The next page will show the features of Delphi XE that are included with your edition (the list of features will differ between Delphi XE Professional and Delphi XE Enterprise). Make sure that the VCL for the Web item is unselected, so it will be removed from your system if it was already installed. If the red cross is already showing, to indicate that it’s not installed on your machine at this time, then you can cancel the dialog. Otherwise, you need to press Next again and continue to allow the installer to modify your installation of Delphi XE and remove the bundled version of IntraWeb XI from your disk.

Delphi Win32 Web Development 3. VCL for the Web / IntraWeb Bob Swart (Bob@5555bf582af90242a895e5d4 ) - 4 -

February 2011

After this process has finished, you should check the Windows\System32 directory to make sure there are no IntraWeb_110_150.bpl and IntraWebDB_110_150.bpl packages left. Same with the C:\Program Files\Embarcadero\RAD Studio\8.0\bin directory, which should no longer contain the dclIntraweb_110_150.bpl design time package. And the C:\Program Files\Embarcadero\RAD Studio\8.0\lib\win32\release directory should no longer contain any IW*.dcu or IW*.res files. If one or more of these conditions fail, and you still find evidence of the bundled version of IntraWeb XI on your machine, then you could either try to uninstall it again (using the above steps) or remove the files manually from your disk – at your own risk, of course, since uninstalling should remove them. However, the best way to remove the bundled version of IntraWeb XI from your installation of Delphi XE is simply to install Delphi XE on a clean machine without having selected IntraWeb XI. Regardless of how you removed the bundled (or previous) version of IntraWeb XI from your machine, you can then download the latest version of IntraWeb XI from the AtoZedSoftware website at 5555bf582af90242a895e5d4/IntraWeb/Download/Download.aspx . At the time of writing, this is IntraWeb XI 11.0.32.

Delphi Win32 Web Development

3. VCL for the Web / IntraWeb Bob Swart Training & Consultancy - 5 - 5555bf582af90242a895e5d4 Installing IntraWeb XI

The IntraWeb XI installer recommends to close all other application – at least Delphi must be closed before you install.

The License Agreement of IntraWeb reminds you that the Personal, Standard and Ultimate licenses are single user licenses only.

Delphi Win32 Web Development 3. VCL for the Web / IntraWeb Bob Swart (Bob@5555bf582af90242a895e5d4 ) - 6 - February 2011 The next step gives some important installation notices, which include a note about Windows firewall which may give a warning when you start Delphi or an IntraWeb application written in Delphi.

The next page can be used to specify the location of IntraWeb XI. Note that it’s no longer installed by default in the Program Files directory, but rather in the C:\Users\CURRENTUSER\AppData\Roaming\IntraWeb XI (where CURRENTUSER is the name of the current user, obviously, or “Bob” in my case).

Delphi Win32 Web Development

3. VCL for the Web / IntraWeb Bob Swart Training & Consultancy - 7 - 5555bf582af90242a895e5d4 Depending on the versions of Delphi on your machine, the next page will give you the option to select the supported versions of Delphi; Delphi 7, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010 or Delphi XE. Since I still want to use IntraWeb 10.x with Delphi 2010 (because of some legacy IntraWeb applications), I only select Delphi XE as target to install IntraWeb XI for.

The start menu folder is called IntraWeb by default.

Delphi Win32 Web Development 3. VCL for the Web / IntraWeb Bob Swart (Bob@5555bf582af90242a895e5d4 ) - 8 - February 2011 The next page requires your IntraWeb XI key. This key starts with +008 (and not +007 which was used for previous versions of IntraWeb). Even as a bundled user, you must request your key at 5555bf582af90242a895e5d4/IntraWeb/Download/FreeKeyRequest.aspx by downloading 5555bf582af90242a895e5d4/intraweb/KeyRequest_RadStudioXE1.zip

Below is the overview of the settings of IntraWeb XI Ultimate 11.0.23 which was installed on my machine with Delphi XE Enterprise.

Delphi Win32 Web Development

3. VCL for the Web / IntraWeb Bob Swart Training & Consultancy - 9 - 5555bf582af90242a895e5d4 Installation will only take a few minutes.

After installation is competed, you will see some post-installation notes. Most of these are outdated. There are only Win32 demos, since .NET is no longer supported for example.

This information should also mention 5555bf582af90242a895e5d4/ as location for some IntraWeb demos.

Delphi Win32 Web Development 3. VCL for the Web / IntraWeb Bob Swart (Bob@5555bf582af90242a895e5d4 ) - 10 -

February 2011

After installing IntraWeb XI, you can check the status and version by starting Delphi XE again, and checking the About Box.

Delphi Win32 Web Development

3. VCL for the Web / IntraWeb Bob Swart Training & Consultancy - 11 - 5555bf582af90242a895e5d4 IntraWeb License Keys

After the installation of IntraWeb XI, if you entered your correct license key numbers during installation, you should find a file called IWLicenseKey.pas in the different library directories of C:\Users\Bob\AppData\Roaming\IntraWeb XI\. For my Delphi XE instllation, this means C:\Users\Bob\AppData\Roaming\IntraWeb XI\LibXE. If you didn’t enter the license key during the installation of the full version, or if you started with an evaluation version and want to turn it into a full version (or if you want to re-start an expired subscription), you need to generate the IWlicenseKey.pas file yourself. This can be done using the LicenseRegistration.exe application that is included with IntraWeb in the C:\Users\Bob\AppData\Roaming\IntraWeb XI\ directory. When you run LicenseRegistration, you only have to paste the Win32 license key:

This application will generate the IWLicenseKey.pas files for you. It will have the following layout (so you can always reproduce this file yourself if you have your key):

unit IWLicenseKey;

interface

implementation

uses

IWGlobal;

initialization

SetLicenseKey(

'+008'+

#########

#########

end .

Delphi Win32 Web Development 3. VCL for the Web / IntraWeb Bob Swart (Bob@5555bf582af90242a895e5d4 ) - 12 - February 2011 Summary

In this section, we have examined the different editions and features of IntraWeb XI. We have covered how to correctly uninstall a previous version of IntraWeb XI, and how to install IntraWeb XE on your machine and integrate it with your copy of Delphi.

Delphi Win32 Web Development

5. IntraWeb Application Mode

Bob Swart Training & Consultancy - 13 - 5555bf582af90242a895e5d4 2. IntraWeb XI Applications

IntraWeb XI can be used to design WYSIWYG web applications. The best way to demonstrate this, it to start Delphi XE, do File | New - Other , go to the VCL for the Web category in the Object Repository, where we can find the two IntraWeb wizards (and three disabled icons):

Double-click on the VCL for the Web Application Wizard to start the dialog below.

Delphi Win32 Web Development 5. IntraWeb Application Mode Bob Swart (Bob@5555bf582af90242a895e5d4 ) - 14 - February 2011 Looking at the dialog, you may wonder if there are only two possible targets, and no more support for a Windows Services. Looks are deceiving, however, since the standalone application can be turned into a Windows Service (and is in fact a Windows Service by running it with the /GUI command-line option. The ISAPI Extension option is available, but can only be deployed for developers using the IntraWeb XI Ultimate license. Be aware of that fact when building a web application, as the ISAPI deployment will fail when using the Personal or Standard edition of IntraWeb. The option to use an ISAPI Threadpool is only relevant when producing an ISAPI DLL for IIS, and disabled otherwise. The choice for pooling data connections will be relevant in the next section (about IntraWeb and Databases) and can be left unchecked for now. Specify IWDemo as Project Name, which will produce a new IntraWeb XI project in the C:\Users\Bob\Documents\RAD Studio\Projects\IWDemo directory:

If you click on OK, then a new IntraWeb standalone application project will be created, as well as three additional units - one for the Server Controller in ServerController.pas, one for the User Session in UserSessionUnit.pas, and one for the IntraWeb Application Form, which can be saved in IWFormMain.pas. IWDemo Project Source

Let’s first examine the generated IWDemo project source code in IWDemo.dpr. Do Project | View Source to see the following code:

program IWDemo;

uses

Forms,

IWStart,

UTF8ContentParser,

IWFormMain in 'IWFormMain.pas' {IWForm1: TIWAppForm},

Delphi Win32 Web Development

5. IntraWeb Application Mode

Bob Swart Training & Consultancy - 15 - 5555bf582af90242a895e5d4 ServerController in 'ServerController.pas'

{IWServerController: TIWServerControllerBase},

UserSessionUnit in 'UserSessionUnit.pas' {IWUserSession: TIWUserSessionBase};

{$R *.res}

begin

TIWStart.Execute(True);

end .

There is no more IWMain unit or IWInitService unit required, and also no Application that needs to be initialized and run. Instead, this has been replaced by an Execute call to TIWStart, from the IWStart unit.

GUI Mode

The argument True specifies that we want to enforce the IWDemo application to start in GUI mode. Note that it’s a defeault argument, and the default is False. Meaning the application should not be forced to start in GUI mode, in which case we need to pass the /GUI command-line flag to the IWDemo.exe in order to start it in GUI mode:

IWDemo.exe /GUI

The option GUI is not case sensitive, so we can also pass /gui for example. As soon as we run the IWDemo application, in GUI mode, we may get a message with a Windows Security Alert dialog, about the feature that has blocked some features of the IntraWeb application:

Obviously, we want to allow the IWDemo.exe application to continue running and operating, so click on Allow access to enabled the IWDemo executable to start the HTTP server inside it.

本文来源:https://www.bwwdw.com/article/lorl.html

Top