Board index » cppbuilder » CppWebBrowser

CppWebBrowser


2003-08-27 11:30:25 AM
cppbuilder48
Hi,
I am using TCppWebBrowser Component. I need to extract data from a table in
a HTML page, and populate it into a string grid, can anyone provide a sample
code as how to accomplish this?
Regards,
Muhammad Momin Rashid.
 
 

Re:CppWebBrowser

I have deisgned a CD-ROM catalogue. It has been programmed with C++ Pro
6.0, using the CppWebBrowser component to display product information web
pages stored locally.
The project has been completed and I have built an install package using
InstallShield 5.0.
My project works perfectly - or so I thought.
On each computer that the catalogue has been installed, I have experienced
problems with Internet Explorer, both Win98 and XP machines. Some websites
are not being displayed correctly - i.e. missing links.
Now this has only occurred on the machines which have the catalogue
installed, and has only been noticed since the catalogue has been installed.
What could possibly be the problem? Am i posting this to the wrong
newsgroup?!
Is there any reason why the CppWebBrowser component may interfere with
Internet Explorer?
I am completely lost!
Any help would be greatly appreciated.
Cheers,
John
XXXX@XXXXX.COM
 

Re:CppWebBrowser

How can I put html code (from memory, not from hard disk) into
CPPWebBrowser - something like .innerHTML in DOM in script languages?
td
 

{smallsort}

Re:CppWebBrowser

"td" < XXXX@XXXXX.COM >wrote in message
Quote
How can I put html code (from memory, not from hard disk) into
CPPWebBrowser
Navigate to "about:blank", then once the OnDocumentComplete event triggers,
you can query the Document for the IPersistStreamInit interface, passing it
an IStream that contains the HTML. You can use the TStreamAdapter class if
your HTML is stored in a VCL TStream class.
Gambit
 

Re:CppWebBrowser

I have:
TMemoryStream* mstm=new TMemoryStream();
IdHTTP->Get("www.dot.com/",mstm);
wb->Navigate((WideString)"about:blank");
and OnDocumentComplete:
IPersistStreamInit* pPersistStreamInit = NULL;
TStreamAdapter *IStr=new TStreamAdapter(mstm,soReference);
wb->Document->QueryInterface(IID_IPersistStreamInit,(void**)&pPersistStreamInit);
pPersistStreamInit->Load(*IStr);
pPersistStreamInit->Release();
pPersistStreamInit=NULL;
unfortunately doesn't work
 

Re:CppWebBrowser

"toudidel" < XXXX@XXXXX.COM >wrote in message
Quote
TMemoryStream* mstm=new TMemoryStream();
IdHTTP->Get("www.dot.com/",mstm);
You did not seek the stream back to Position=0 before loading it into the
browser.
Quote
TStreamAdapter *IStr=new TStreamAdapter(mstm,soReference);
You are leaking your TStreamAdapter. You never free it.
Quote

wb->Document->QueryInterface(IID_IPersistStreamInit,(void**)&pPersistStreamI
nit);
Always make sure to check that QueryInterface() actually succeeds before
trying to access the interface that it returns.
Gambit
 

Re:CppWebBrowser

thank so much, by the way: don't you know how can I set my custom
HTTP_USER_AGENT for CppWebBrowser's reuqests?
td
 

Re:CppWebBrowser

everything OK, it works but changing URL to "about:blank" has change the
base url of the html document, so all images, scripts etc try be written
from about:blank, for example img src="about:blank/pic.gif".
 

Re:CppWebBrowser

"toudidel" < XXXX@XXXXX.COM >wrote in message
Quote
everything OK, it works but changing URL to "about:blank" has
change the base url of the html document, so all images, scripts
etc try be written from about:blank, for example img
src="about:blank/pic.gif".
You must navigate to "about:blank" (or more accurately, nagivate to any
valid URL). You cannot load a stream into an uninitialized Document.
Gambit
 

Re:CppWebBrowser

"toudidel" < XXXX@XXXXX.COM >wrote in message
Quote
thank so much, by the way: don't you know how can I set my
custom HTTP_USER_AGENT for CppWebBrowser's reuqests?
TIdHTTP's Request object has a UserAgent sub-property.
Gambit
 

Re:CppWebBrowser

I need some help on how to view the HTML code from a page i've loaded into
the CppWebBrowser1-box.
If you can write how I can but it in a Memo-box I would be happy :)
/J
 

Re:CppWebBrowser

"Jesper" < XXXX@XXXXX.COM >wrote:
Quote
I need some help on how to view the HTML code from a page i've loaded into
the CppWebBrowser1-box.
If you can write how I can but it in a Memo-box I would be happy :)

/J


AnsiString filename;
IHTMLDocument2 *HTMLDocument;
IPersistFile *PersistFile;
try
{
CppWebBrowser1->Document->QueryInterface(IID_IHTMLDocument2,
&((void*)HTMLDocument) );
HTMLDocument->QueryInterface(IID_IPersistFile, &((void *)PersistFile));
PersistFile->Save(WideString(String(filename)), true);
PersistFile->Release();
HTMLDocument->Release();
}
catch(...)
{
}
if(FIleExists(filename))
MemoBox->LoadFromFile(filename);
 

Re:CppWebBrowser

"caleb" < XXXX@XXXXX.COM >wrote in message
Quote
IPersistFile *PersistFile;
<snip>
You don't need a temporary file at all. You can save the HTML to a TStream
via the IPersistStreamInit interface and the VCL's TStreamAdapter class.
Then you can use the TMemo's LoadFromStream() method instead of
LoadFromFile().
Gambit
 

Re:CppWebBrowser

I made a web browser with CppWebBrowser, could you tell me how to get
hyperlink address?
ADAM
--
Borland中文社区
www.BorlandBBS.cn
 

Re:CppWebBrowser

I made a web browser with CppWebBrowser, could you tell me how to get
hyperlink address?
--
Borland中文社区
www.BorlandBBS.cn