🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.web
4 messages
4 total messages Started by Albert Wiersch Mon, 21 Feb 2005 23:08
TCppWebBrowser locks up
#1334
Author: Albert Wiersch
Date: Mon, 21 Feb 2005 23:08
15 lines
1281 bytes
If I am viewing a ***local file*** like C:\html\test.html in TCppWebBrowser 
with this:
<a href="./">test</a>

And I click on the "test" link in the browser, it then displays the contents 
of the directory, similar to Windows Explorer, but my application locks up.

Does anyone know what could be wrong and causing this to lock up my 
application? Other than that, it seems to work well.

Thank you.

-- 
Albert Wiersch
Re: TCppWebBrowser locks up
#1335
Author: Hans Galema
Date: Tue, 22 Feb 2005 12:07
15 lines
1395 bytes
Albert Wiersch wrote:
> If I am viewing a ***local file*** like C:\html\test.html in TCppWebBrowser 
> with this:
> <a href="./">test</a>
> 
> And I click on the "test" link in the browser, it then displays the contents 
> of the directory, similar to Windows Explorer,

This is an incredible feature.

> but my application locks up.

Mines does not. What else is in that page ?

Hans.
Re: TCppWebBrowser locks up
#1336
Author: Albert Wiersch
Date: Tue, 22 Feb 2005 17:04
108 lines
3826 bytes
Here is the page:
<html>
<body>
<a href="./">Directory</a>
</body>
</html>

I've traced the lockup to the below function which basically tries to save 
the source document to a file... but there really isn't a source document so 
this must have something to do with it. I will do some more tracing. Any 
ideas would be great... thanks.

int __fastcall TCSEQEForm::AWWBDocumentComplete(TObject *Sender, LPDISPATCH 
pDisp, tagVARIANT *URL, int flags) {

 int retval=0;

 int cf=FALSE; // completely finished loading
 if (WB->Busy) return 2; // shouldn't be busy
 HRESULT hr;
 LPUNKNOWN lpUnknown;
 LPUNKNOWN lpUnknownWB=NULL;
 LPUNKNOWN lpUnknownDC=NULL;

 lpUnknown=WB->ControlInterface;
 if (lpUnknown) {
  hr=lpUnknown->QueryInterface(IID_IUnknown,(LPVOID *)&lpUnknownWB);
  if (SUCCEEDED(hr)) {
   hr=pDisp->QueryInterface(IID_IUnknown,(LPVOID *)&lpUnknownDC);
   if (SUCCEEDED(hr)) {
    if (lpUnknownWB==lpUnknownDC)
     cf=TRUE;
   }
  }
 }

 if (lpUnknownWB) lpUnknownWB->Release();
 if (lpUnknownDC) lpUnknownDC->Release();

 if (!cf) return 1; // not finished

 AnsiString locurl=WB->LocationURL;
 StrStore locurlstrstore=locurl.c_str();
 if (locurl=="") return -3; // how did this happen?
 OpenCombo->Text=locurl; // new 6/13/2000

 int savesuccess=FALSE;
 try {
  AWWBWait(2);
  if ( (WB) && (WB->Document) ) {
   IPersistFile *IpersFile=NULL;
   {
    while (1) {
     HRESULT hr2=WB->Document->QueryInterface(IID_IPersistFile,(void 
**)(&IpersFile));
     if ( (SUCCEEDED(hr2)) && (IpersFile) ) {
      HRESULT 
saveresult=IpersFile->Save(StringToOleStr(p->vol->WBsourcefilename.getString()),false);

      if (saveresult==S_OK) { // 0 is success, non-zero is failure
       savesuccess=TRUE; break;
      }
      else {
       SetStatusBarText("Failed to save web browser source HTML."); // new 
2004-02-09
       if (IpersFile) {
        IpersFile->Release(); IpersFile=NULL;
       }
       WBRefreshBtnClick(Sender); // workaround for problem where pages 
aren't saved successfully (???)
       return retval;
      }
     }
    }
   }
   if (IpersFile) {
    IpersFile->Release(); IpersFile=NULL;
   }
  }
 } catch (...) { }

 return retval;
}
//---------------------------------------------------------------------------

-- 
Albert Wiersch
http://www.htmlvalidator.com/


"Hans Galema" <notused@notused.nl> wrote in message 
news:421b20d1@newsgroups.borland.com...
> Albert Wiersch wrote:
>> If I am viewing a ***local file*** like C:\html\test.html in 
>> TCppWebBrowser with this:
>> <a href="./">test</a>
>>
>> And I click on the "test" link in the browser, it then displays the 
>> contents of the directory, similar to Windows Explorer,
>
> This is an incredible feature.
>
>> but my application locks up.
>
> Mines does not. What else is in that page ?
>
> Hans. 
Re: TCppWebBrowser locks up
#1337
Author: Albert Wiersch
Date: Tue, 22 Feb 2005 17:17
44 lines
2290 bytes
Oops. I found the problem. The situation I mentioned causes an infinite loop 
in the while (1) loop. I think I can fix that. :-)

-- 
Albert Wiersch
http://www.htmlvalidator.com/


"Albert Wiersch" <mrinternetnewsborland@wiersch.com> wrote in message 
news:421b660a$1@newsgroups.borland.com...
>
>    while (1) {
>     HRESULT hr2=WB->Document->QueryInterface(IID_IPersistFile,(void 
> **)(&IpersFile));
>     if ( (SUCCEEDED(hr2)) && (IpersFile) ) {
>      HRESULT 
> saveresult=IpersFile->Save(StringToOleStr(p->vol->WBsourcefilename.getString()),false);
>
>      if (saveresult==S_OK) { // 0 is success, non-zero is failure
>       savesuccess=TRUE; break;
>      }
>      else {
>       SetStatusBarText("Failed to save web browser source HTML."); // new 
> 2004-02-09
>       if (IpersFile) {
>        IpersFile->Release(); IpersFile=NULL;
>       }
>       WBRefreshBtnClick(Sender); // workaround for problem where pages 
> aren't saved successfully (???)
>       return retval;
>      }
>     }
>    }
>   }
>   if (IpersFile) {
>    IpersFile->Release(); IpersFile=NULL;
>   }
>  }
> } catch (...) { }
>
> return retval;
> }
> //---------------------------------------------------------------------------
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads