[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

WebBrowser problem

Posted on 2002-07-22
5
Medium Priority
?
653 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 200 total points
ID: 7169818
0

Featured Post

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!

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…
Loops Section Overview
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month18 days, 1 hour left to enroll

829 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