Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

TWebBrowser??

Posted on 2001-08-01
4
Medium Priority
?
197 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 1000 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

715 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