Solved

TWebBrowser??

Posted on 2001-08-01
4
192 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

839 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