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
Solved

WebBrowser problem

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
delphi exception 7 68
Help on project with Soap 10 57
URL for downloading Google Chrome for Win XP 2 181
Delphi...Split view - idea? 1 87
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

790 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