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

x
?
Solved

Accelerate TWebBrowser loading (D5)

Posted on 2001-07-16
10
Medium Priority
?
207 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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 600 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
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