RAD Studio |  |

Changing VCL for the Web application type
See Also
Collapse All

If you have created a VCL for the Web application and wish to change it to ISAPI/NSAPI or Apache plugins, you can do it with a few simple changes to your code.

It is, however, recommended that you start with a standalone application, to ease debugging, and later convert the application to an extension.

To change your standalone application to ISAPI/NSAPI:

1. Open the project source file by selecting ProjectView Source.
2. In the project source file, change the application type from program to library:
3. In the uses clause, replace the Forms and IWMain units with ISAPIApp and IWInitISAPI. If you want to use ISAPIThreadPool, include the ISAPIThreadPool unit in the uses clause.
4. Add the following exports section before the program entry point:

Copy Code

    exports
      GetExtensionVersion,
      HttpExtensionProc,
      TerminateExtension;

1. Replace the contents of begin ... end block with:

Copy Code

    begin
      IWRun;
    end.

When you are done the project source file should look like this:

Copy Code

    library Project1;

    uses
      ISAPIApp,
      IWInitISAPI,
      ISAPIThreadPool,
      Unit1 in 'Unit1.pas' {IWForm1: TIWAppForm},
      ServerController in 'ServerController.pas' {IWServerController: TIWServerControllerBase},
      UserSessionUnit in 'UserSessionUnit.pas' {IWUserSession: TIWUserSessionBase};

    {$R *.RES}

    exports
      GetExtensionVersion,
      HttpExtensionProc,
      TerminateExtension;

    begin
      IWRun;
    end.

To change your standalone application to a service application:

1. Open the project source file by selecting ProjectView Source.
2. In the uses clause, replace the Forms and IWMain units with IWInitService.
3. Replace the contents of the begin ... end block with:

Copy Code

    begin
      IWRun;
    end.

See Also

Creating a New VCL for the Web Application

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!