The example Microsoft has provided to load HTML from streams works
fine for simple text but does not work for Bitmaps.
[pPersistStreamInit->Load]
http://msdn.microsoft.com/en-us/library/aa752047(VS.85).aspx
Is there a way to load a bitmap directly from a stream into the web
browser without creating an intermediate file?
Best Regards,
Vishal
with which browser ?
MSIE is known to NOT support "inline" image in base64 format
(may be the rel.8 finally does that) but other browsers do
that for a while.
Sylvain.
I have to support starting IE 6.0 :(.
Is there a work around?
Best Regards,
Vishal
none I'm aware of. I mean for plain html or xml files,
I think there is NO work around.
But you can write or use an activeX component that
will accept the image definition from its parameters.
Sylvain.
Plain text works fine if I do it through IPersistStreamInit as per the
link I mentioned. I am facing a problem with bitmap.
Best Regards,
Vishal
Any clues?
expect the advice above you apparently missread ? no.
SF.
What doesn't work ?
It works for me with IE6 from a stream created from a bitmap file
(just by copy-paste MS code...)
Yes after testing I realized that this is working on IE 6.0 and IE 7.0
but not on IE 8.0 beta version.
IE 8.0 beta just shows me an icon that represents bad image path.
Also I am not writing the code in the document complete event. But I
don't think that should matter as the same code works in other cases.
something like:
static TCHAR szHTMLText[] =
"<html><body><img src='data:image/jpg;base64,/9j/4AAQSkZJRgABA...' />"
"</body></html>";
> It works for me with IE6 from a stream created from a bitmap file
something like:
static TCHAR szHTMLText[] =
"<html><body><img src='pathname.jpg' /></body></html>";
of course does work ... if pathname.jpg exists.
but generating additional temp file can be a mess (or just
impossible - from a C/C++ component embedded in a .chm for
instance).
Sylvain.
It works fine on IE 6 and 7 without generating a temporary file.
Looks like some more functionality is broken in IE 8.0. I also tried
the IPersistMoniker approach with the same results. jpg just would not
load.
Approach1:
1. Console C++ application.
2. Use IWebBrowser2 to navigate to about:blank URL.
3. Get html document and get IPersistStreamInit interface.
4. Load the file in my stream.
5. Call the load method of IPeristStreamInit interface passing in my
stream.
6. BMPs would not load in IE 8.0 only. I can see a broken image. IE
6.0 and 7.0 work fine.
7. Text files load fine in all the 3 versions.
Approach2:
1. Console C++ application.
2. Use IWebBrowser2 to navigate to about:blank URL.
3. Create my own class derived from IMoniker. [Override all the
methods of IMoniker, IPersistStream, IUnknown]
4. Implement only BindToStorage and GetDisplay name as suggested in
the above posts. Also the my stream is loaded in this class.
5. Rest methods will just return E_NOTIMPL.
6. BMPs would not load in IE 8.0 only. I can see a broken image. IE
6.0 and 7.0 work great.
7. Text files load fine in all the 3 versions.