August 8th, 2013, 09:46 PM
Help Displaying an HTML file with Delphi
I intended to post this in the HTML section. I don't know how it got here unless someone moved it here.
But, if any admin could move it to the appropriate HTML seciont of this forum, I would very much appreciate it.
Hello. This is my first post.
I have been using Delphi for several years but I am not really very expert. I do have Delphi v7.2 and I would like to display some info I have taken from an HTML file.
Actually, I accessed a web site on the net and then saved the page as an ".HTM" file. The page is very basic.
I would like to be able to write a Delphi app that takes some or all of the data from an ".HTM" file and displays it on the screen and then interacts with the user and then blank the screen and display some other ".HTM" file.
Is there any simple way to do this? I have read some info from one site but it was extremely complicated and I couldn't get it to work.
Part of the problem was that I had to use a THTMLViewer component and I just couldn't find a way to make it work. The compiler kept telling me that it could not find some simple ".DCU" files - such as "variants.dcu".
Can anyone show me a simple working example that just reads a file containing an ".HTM" file and displays it in a Delphi app?
I anticipate that my app will not be run over the Internet. It is something that a single user will run in a "standalone" mode.
August 9th, 2013, 11:09 PM
variants.dcu is part of Delphi. You need to find out why it is either missing from your install or not on a path the compiler can find.
August 10th, 2013, 11:43 AM
Yes. That makes sense. My Delphi V4.0 compiler is set up to use the path for that includes the
Originally Posted by clivew
C:\PROGRAM FILES (X86)\BORLAND\DELPHI4\LIB\
I guess I have to point it to the Delphi v7.2 library.
I'll try that and let you know.
August 18th, 2013, 12:38 AM
If you have Delphi 7.2, why do you still use Delphi 4? I am not sure if D4 has Variants unit. You should check THTMLViewer documentation to see which Delphi versions it supports. Versions older than these usually require some adjustment. Some even won't be able to support THTMLViewer.
On the topic, why don't you just use TWebBrowser? It's wrapper to IE, so it definitely will be able to render your .html files. You can capture user clicks by handling the OnBeforeNavigate event, then do adjustment as in redirect to correct url or load correct .html file.
August 18th, 2013, 06:24 PM
Thank you very much. I have gotten this working now using TWebBrowser as you suggest.
Originally Posted by Luthfi