🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.web
8 messages
8 total messages Started by td Fri, 03 Jun 2005 20:34
CppWebBrowser
#1152
Author: td
Date: Fri, 03 Jun 2005 20:34
4 lines
988 bytes
How can I put html code (from memory, not from hard disk) into
CPPWebBrowser - something like .innerHTML in DOM in script languages?

td
Re: CppWebBrowser
#1153
Author: Remy Lebeau (TeamB)
Date: Fri, 03 Jun 2005 20:52
14 lines
1308 bytes
"td" <toudidel@o2.pl> wrote in message
news:42a0be46@newsgroups.borland.com...

> 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
#1166
Author: toudidel
Date: Wed, 08 Jun 2005 12:25
18 lines
1415 bytes
I have:

TMemoryStream* mstm=new TMemoryStream();
IdHTTP->Get("http://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
#1168
Author: Remy Lebeau (TeamB)
Date: Wed, 08 Jun 2005 17:05
23 lines
1543 bytes
"toudidel" <toudidel@oDWA.pl> wrote in message
news:42a6e393$1@newsgroups.borland.com...

> TMemoryStream* mstm=new TMemoryStream();
> IdHTTP->Get("http://www.dot.com/",mstm);

You did not seek the stream back to Position=0 before loading it into the
browser.

> TStreamAdapter *IStr=new TStreamAdapter(mstm,soReference);

You are leaking your TStreamAdapter.  You never free it.

>
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
#1169
Author: toudidel
Date: Thu, 09 Jun 2005 07:25
4 lines
1099 bytes
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
#1170
Author: toudidel
Date: Thu, 09 Jun 2005 08:05
3 lines
1200 bytes
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
#1174
Author: Remy Lebeau (TeamB)
Date: Thu, 09 Jun 2005 17:15
14 lines
1567 bytes
"toudidel" <toudidel@oDWA.pl> wrote in message
news:42a7f842@newsgroups.borland.com...

> 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
#1173
Author: Remy Lebeau (TeamB)
Date: Thu, 09 Jun 2005 17:16
11 lines
1296 bytes
"toudidel" <toudidel@oDWA.pl> wrote in message
news:42a7eebc@newsgroups.borland.com...

> 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
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