Solved

WebBrowser problem

Posted on 2002-07-22
5
614 Views
Last Modified: 2007-12-19
Here is my code:
var
  URL: OleVariant;
begin
  ShowBlankPage(WB);
  URL := 'c:\blank.htm';
  WB.Navigate2(URL); <----An error occasionally occurs here!
  with WB do
  begin
    while (ReadyState <> READYSTATE_COMPLETE) do
      Forms.Application.ProcessMessages;
  end;
end;

The Error message is "The requested resource is in use".
I wonder how this happens and how to resolve this problem?
0
Comment
Question by:hpsmall
5 Comments
 
LVL 7

Expert Comment

by:Cynna
ID: 7169258
Sorry, can't reproduce this error (after commenting out ShowBlankPage(WB) call).

Just offhand - maybe try preventing a call to Navigate until you are certain previous navigation is finished, using global flag variable.

Like this:

var WBBusy: Boolean=FALSE; // global flag

// .....

var
 URL: OleVariant;
begin
 if WBBusy then Exit;
// Set flag to "busy"
 WBBusy:=TRUE;
 ShowBlankPage(WB);
 URL := 'c:\blank.htm';
 WB.Navigate2(URL);
 with WB do
 begin
   while (ReadyState <> READYSTATE_COMPLETE) do
     Forms.Application.ProcessMessages;
 end;
 // Set flag to "not busy"
 WBBusy:=FALSE;
end
0
 
LVL 17

Expert Comment

by:geobul
ID: 7169406
Hi,
About a possible reason:
When the file is opened in Exclusive or DenyRead mode by another program (or the same program before that code) then a similar error page appears in my browser.

Regards, Geo
0
 

Author Comment

by:hpsmall
ID: 7169527
Sorry,the code is:

var
  URL: OleVariant;
begin
  URL := 'about:blank';
  WB.Navigate2(URL);
  with WB do
  begin
    while (ReadyState <> READYSTATE_COMPLETE) do
      Forms.Application.ProcessMessages;
  end;
0
 

Author Comment

by:hpsmall
ID: 7169541
I've used ActiveX Server to get information from TwebBrowser.When ActiveX Server sends a message to my program and my program changes Url of TWebBrowser,an error occurs immediately.
0
 
LVL 17

Accepted Solution

by:
inthe earned 100 total points
ID: 7169818
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

920 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now