Solved

WebBrowser problem

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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

726 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