Board index » cppbuilder » TCppWebBrowser locks up

TCppWebBrowser locks up


2005-02-16 11:28:24 AM
cppbuilder76
If I am viewing a local file 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.
Remy Lebeau (TeamB), do you know?
Thank you.
--
Albert Wiersch
 
 

Re:TCppWebBrowser locks up

If I am viewing a local file 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

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
 

{smallsort}

Re:TCppWebBrowser locks up

Albert Wiersch wrote:
Quote
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.
Quote
but my application locks up.
Mines does not. What else is in that page ?
Hans.
 

Re:TCppWebBrowser locks up

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
www.htmlvalidator.com/
"Hans Galema" < XXXX@XXXXX.COM >wrote in message
Quote
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

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
www.htmlvalidator.com/
"Albert Wiersch" < XXXX@XXXXX.COM >wrote in message
Quote

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;
}
//---------------------------------------------------------------------------