Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

IWebBrowser2, IStream and Bitmap.

64 views
Skip to first unread message

Vishal Pai

unread,
May 4, 2009, 7:33:04 PM5/4/09
to
Hi,

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

Sylvain SF

unread,
May 4, 2009, 7:46:06 PM5/4/09
to
Vishal Pai a �crit :

>
> Is there a way to load a bitmap directly from a stream into the web
> browser without creating an intermediate file?

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.

Vishal Pai

unread,
May 4, 2009, 8:05:09 PM5/4/09
to
On May 4, 4:46 pm, Sylvain SF <sylv...@boiteaspam.info> wrote:
> Vishal Pai a écrit :

I have to support starting IE 6.0 :(.

Is there a work around?

Best Regards,
Vishal

Sylvain SF

unread,
May 4, 2009, 8:25:49 PM5/4/09
to
Vishal Pai a �crit :

>>
>> 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.
>>
> I have to support starting IE 6.0 :(.
> Is there a work around?

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.

Vishal Pai

unread,
May 4, 2009, 8:59:25 PM5/4/09
to
On May 4, 5:25 pm, Sylvain SF <sylv...@boiteaspam.info> wrote:
> Vishal Pai a écrit :
>
>
>

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

Vishal Pai

unread,
May 5, 2009, 4:06:19 PM5/5/09
to

Any clues?

Sylvain SF

unread,
May 5, 2009, 4:37:05 PM5/5/09
to
Vishal Pai a �crit :

>>
>>
>>>>> 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.
>>>> I have to support starting IE 6.0 :(.
>>>> Is there a work around?
>>> 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.
>
> Any clues?

expect the advice above you apparently missread ? no.

SF.

Christian ASTOR

unread,
May 6, 2009, 5:29:50 AM5/6/09
to

What doesn't work ?
It works for me with IE6 from a stream created from a bitmap file
(just by copy-paste MS code...)

vpaive...@gmail.com

unread,
May 6, 2009, 2:10:33 PM5/6/09
to

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.

Sylvain SF

unread,
May 6, 2009, 9:58:06 PM5/6/09
to
Christian ASTOR a �crit :

>
>> 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
>>
> What doesn't work ?

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.

vpaive...@gmail.com

unread,
May 6, 2009, 11:18:00 PM5/6/09
to
On May 6, 6:58 pm, Sylvain SF <sylv...@boiteaspam.info> wrote:
> Christian ASTOR a écrit :

It works fine on IE 6 and 7 without generating a temporary file.

vpaive...@gmail.com

unread,
May 8, 2009, 8:11:16 PM5/8/09
to

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.

0 new messages