Solved

TWebBrowser??

Posted on 2001-08-01
4
194 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

738 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