HTML Viewing Component for Delphi 2
.0HTML Viewing Component for Delphi 2
.0 !?!Hello everybody! In little pause between “Digital Sound” articles, I present you HTML Viewing Component for Delphi 2.0. as promised in the title. This component is based on object technology called “OCX”. OCX is component comparable with VBX used by Visual Basic (which is support from first version of Delphi). Difference is that OCX is 32-bit, works under Win 95/NT and much more programs support it.
So if you have installed Internet Explorer you can use it as HTML viewer component in your applications. Also you may find much more applications support this OCX method of control (when I installed the HTML OCX, I wonder how many components can I have installed and I don’t - FTP client, Real Audio player,...). You may oppose me that there is OCX tab-sheet in Delphi with some components -Yeah, but only with the ones which came with Delphi. The only thing you have to do is to install these OCX modules into component library via “Component | Install” (for more on this, refer to Delphi help, topic “OCX” or “installing components”).
Using OCX components
How simple! Now I have HTML viewing component, I don’t need you anymore, hah ! No, it is not so easy - you have the component installed, but do you know any method identifier of this component ? Trying pressing F1 for help - oops, nope found.
Well I was surprised too. But help is relatively easy. You even do not need to mail to Microsoft to ask them for some methods. Delphi I don’t exactly know how, but it creates complete unit (.PAS file) for handling this component. Just take a look in your Delphi directory (folder) and look to sub-dir LIB. There should be file “SHELL.PAS” if everything worked OK. In this file is complete both interface and implementation. But for the curious ones - implementation is not reverse-compilation of the OCX-component - it is only calling its method using “InvokeMethod”.
Basic reference on Texplorer component
Here is list of most important basic functions (at least I think they are important, I had not need to use any other):
Navigate - use filename or internet address and four variables of variant type. This example opens web pages of UNDU in Texplorer. Don’t forget to resize it in design enough to see something.
Var v1,v2,v3,v4:variant;
begin
Explorer1.navigate (‘www.undu.com’,v1,v2,v3,v4);
end;
GoHome, GoBack, GoSearch - these commands have same function as buttons on IE panel have.
A final comment
I hope some will find this method useful. It does work without IE (I think, I hadn’t tried it), but when you need HTML component and have not Delphi 3.0, you may find this interesting. I would like to apologize maximum simplicity of this article, but as I wrote, I had no need to find out more, so I someone is interested, I hope we will get more articles on this topic from someone else. Also please apologize, if you find this article bit chaotic - I was ill, when writing it. And as usual please be merciful to my English.
See you at “Digital Sound in Delphi - part III”
Stanislav Holenda.