Solved

TWebBrowser??

Posted on 2001-08-01
4
187 Views
Last Modified: 2010-04-06
I just updated to Delphi 4 standard (from Delphi 2) and am trying out a few things with it.

I saw a short article on the web about adding in the Microsoft Internet Controls so i followed the instructions and now have two new components:

WebBrowser_V11:TWebBrowser_V1
WebBrowser1:TWebBrowser

My problem:

(1) I understand that the TWebBrowser can be used for displaying web pages, etc but what is the other component and the limitations of both of them (ie: can i display html files which contains javascript, graphics, etc?)

(2) Can anyone show me how to use the TWebBrowser to do such things as load html files from disk, display scroll bar if required only, etc.

I am completely new to this.





0
Comment
Question by:foxjax
  • 3
4 Comments
 
LVL 1

Expert Comment

by:h_mohsenian
ID: 6341237
listening ...  :-)


( just say : you can Call IE from your Delphi App that means you can write your HTML file by Delphi App then call IE by this procedure : )


procedure OpenInternetExplorer( sURL : string );
const
  csOLEObjName = 'InternetExplorer.Application';
var
  IE        : Variant;
  WinHanlde : HWnd;
begin
  if( VarIsEmpty( IE ) )then
  begin
    IE := CreateOleObject( csOLEObjName );
    IE.Visible := true;
    IE.Navigate( sURL );
  end else
  begin
    WinHanlde := FindWIndow( 'IEFrame', nil );
    if( 0 <> WinHanlde )then
    begin
      IE.Navigate( sURL );
      SetForegroundWindow( WinHanlde );
    end else
    begin
      // handle error ...
    end;
  end;
end;


best regards
hamed
0
 
LVL 1

Expert Comment

by:h_mohsenian
ID: 6341262
also you can see an standard Delhi demo about your need :

see Delphix\Demos\coolstuf\webbrows

i think it is an complete Demo App for TWebBrowse. although I never saw him until now that I search !;-)

best regards
hamed
0
 
LVL 1

Expert Comment

by:h_mohsenian
ID: 6341267
ops . i told him instead of it ;-)
0
 
LVL 6

Accepted Solution

by:
edey earned 250 total points
ID: 6341340
(1) I understand that the TWebBrowser can be used for displaying web pages, etc but what is the other
component and the limitations of both of them (ie: can i display html files which contains javascript,
graphics, etc?)

It has exactly the same limitations/abilities as Internet Explorer

(2) Can anyone show me how to use the TWebBrowser to do such things as:

a)load html files from disk

webBrowser1.navigate(some_url);
any url is valid, try www.experts-exchange.com or even a local file.  You can even navigate to 'about:blank' or 'about: <html><body>hi<br><b><i><font size=40 color=red>bye</font></i></b></body></html>'

b)display scroll bar if required only, etc.

Hmm, it'll only display the horz scrollbar when needed & I'm sure there's a way to do that for the vert one as well, but I don't know off hand.

You might also want to note that you can access the current document like so:

var
 doc : variant;
begin
 doc := webBrowser1.document;
 doc.write('<p>why hello there</p>');

members.home.com/hfournier is a good place to look for ie with delphi info.  You can also script the control like this:

scriptControl1.addObject('doc',webBrowser1.document,true);
script.eval(edit1.text);

GL
Mike

0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
This video discusses moving either the default database or any database to a new volume.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now