Solved

WebBrowser problem

Posted on 2002-07-22
5
611 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

743 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

11 Experts available now in Live!

Get 1:1 Help Now