Add a (complex as you like) web page to your VCL application

This is the forum for miscellaneous technical/programming questions.

Moderator: 2ffat

Add a (complex as you like) web page to your VCL application

Postby denville » Wed Jan 03, 2018 5:16 am

I recently rediscovered IntraWeb and used it to do a webby job. Since all this Web stuff is relatively new to me I found IntraWeb to be invaluable (in fact I am in complete awe of what has been achieved). The onlu problem is that documentation is a bit sparse and tends to be out of date - but this is compensated for by great personal attention.

Anyway, one thing I had to do was to add a Web form to an existing VCL application. It turned out to be so unbelievably easy (actually even easier than the Delphi example) that I thought I would share it with you - here! I am using XE7 and the latest IntraWeb version 14.2.5. (I will also posted this note in the IntraWeb forum at: https://forums.embarcadero.com/forum.jspa?forumID=93

First create a temporary IW application with a token main web form.
This automatically creates a rudimentary web form (put a label or something
in it) and default ServerController and UserSession units, which can all be
added to the vcl project as-are.

Run the temporary application the close it (as a project it's finished with).

Create the VCL application in the usual way. Save it in the same directory as the
temporary one This makes it easy to...

Add to the VCL application the Web form, ServerController, and UserSession
files that had been created by the temporary application.
In the VCL form:
Add the additional include: #include "IW.Server.Indy.hpp"
In eg the constructor, add the start command:
IWStandAloneServer1->Start( __classid(TSaServerIndy) );
Adding also the line..
IWStandAloneServer1->Run();
..will automatically start a browser session, very convenient when
testing, else you have to point your browser at the application each
time you run it.

Build and run your VCL / Intraweb application !

WARNING: There is seemingly a bug in XE7 debugging environment that sometimes
causes the application to hang very early in start-up. I spent a long time
trying to 'fix' this thinking there was something wrong with what I was doing.
However, I am assured and now completely accept that it is an XE7 issue.

BUT be warned - once hung, the whole of XE7 can become frozen, there is
usually no way to recover other than using Task Manager to end XE7
unconditionally - so make sure you save your work before doing any
debugging. Personally I found testing the application using the big
green Run Without Debugging button perfectly satisfactory and a lot
more convenient, most of the time.
denville
BCBJ Veteran
BCBJ Veteran
 
Posts: 52
Joined: Sat Mar 06, 2010 4:40 am

Re: Add a (complex as you like) web page to your VCL applica

Postby Lena » Thu Jan 04, 2018 4:01 am

Thank you very much for the information!
Lena
BCBJ Master
BCBJ Master
 
Posts: 561
Joined: Sun Feb 06, 2011 1:28 pm


Return to Technical

Who is online

Users browsing this forum: Google [Bot] and 9 guests