Solved

Accelerate TWebBrowser loading (D5)

Posted on 2001-07-16
10
204 Views
Last Modified: 2010-04-04
Hi, In my app, I intended to add in several forms a TWebBrowser component.

the problem is that to avoid using too many resources, I destroy each
form when I don't need it.

Now each time I navigate, the component apparently needs to be
instanciated at the moment the navigation occurs, and this can take
some time

What I would like ideally is to instanciate the component in a thread
after my app starts, and to be able to reuse it from the forms where
the tembeddedwb is dropped.

any clues ?

thanks for your help

0
Comment
Question by:mhervais
[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
  • 5
  • 4
10 Comments
 
LVL 13

Expert Comment

by:Epsylon
ID: 6286647
I'm afraid you can't poke around to much with TWebBrowser since it intend to live its own life. E.g. when TWebBrowser is invisible, its events won't work.

Maybe you can move one instance to another form by changing its parent to the new form.
0
 
LVL 17

Expert Comment

by:inthe
ID: 6286671
i never used threads properly so im kinda "listening in" but you can create and destroy the browsers at runtime if needed.(have example if needed dont know how stable but no crashes here)
also you can navigate to embeddedwb1.go('about:blank') to get it going..
navigating to a site on formcreate event seems to take forever ;-) ( i noticed when testing for your other q)
0
 
LVL 4

Author Comment

by:mhervais
ID: 6286776
Well Epsilon, I know an example of UILess parser that works on top of a TWebbrowser.

I hope some ideas would come up

however, my problem is less about trying to bring up a browser in a thread and more about avoiding to reload it all the time

cheers, Marc
0
Technology Partners: 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!

 
LVL 13

Expert Comment

by:Epsylon
ID: 6286846
Hmmm... I'm afraid I don't know how to solve this...

Btw, are you talking about this ui-less parser?
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 6286847
0
 
LVL 4

Author Comment

by:mhervais
ID: 6287484
yes this one.
of course you can always simulate an ui les webbrowser by making it flat and with no size.

Might be an idea to see if I could have the same webbrowser opened and change owner each time I need it.
do you have a snippet for that?  
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 6287712
This does not change the owner. It changes the parent. If it is useable, I don't know  :o)
Here are the snippets:


------- Unit1 --------

var
  wb: TWebBrowser;

implementation

uses Unit2;

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
begin
  wb := TWebBrowser.Create(Self);
end;

procedure TForm1.FormActivate(Sender: TObject);
begin
  wb.ParentWindow := Handle;
end;





------- Unit2 --------

implementation

uses Unit1;

{$R *.DFM}

procedure TForm2.FormActivate(Sender: TObject);
begin
  wb.ParentWindow := handle;
end;
0
 
LVL 4

Author Comment

by:mhervais
ID: 6287773
will try it tomorrow.
is changing the parent sufficient to redraw the component at the right place?

I suppose I will have to set the position and ask a redraw of the window. but what happens in case of resizing of the form?
0
 
LVL 13

Accepted Solution

by:
Epsylon earned 200 total points
ID: 6289386
If you change the parentwindow property, all other properties remain what they are. On startup (or when you switch), you can set the boundaries or whatever:

procedure TForm1.FormCreate(Sender: TObject);
begin
  wb := TWebBrowser.Create(Self);
  wb.ParentWindow := Handle;
  wb.SetBounds(10, 10, 400, 300);
end;
0
 
LVL 4

Author Comment

by:mhervais
ID: 6304049
I did not do it exactly like that but it works.
however, I have exceptions upon closing the form with a web browser on it. I guess the component is a bit touchy.

regards, Marc
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

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…
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…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Suggested Courses
Course of the Month7 days, 4 hours left to enroll

623 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