Using in-memory interfaces for images in Browser Control?

  • Thread starter Thread starter BrianGenisio
  • Start date Start date
B

BrianGenisio

Hello all,

Suppose I am using the browser control in my application to display my
own HTML code. Now, suppose I want to show images on the page that I
currently have in memory.

One way to do this is to write the image to the file system...
presumably the temp space... and then grab the IHtmlImgElement object,
and set the source to the file location. This works really well.

BUT, lets now assume that I do not have access to write to the file
system. I have the image data in a memroy buffer... how do I hand that
to the DOM or browser control, and bypass the act of having the control
use the src attribute?

Are there any callbacks that I am missing, where I can override the
default download behavior? Something where the browser control says
"Hey! I need image blahblablah!" and I say "Here! Use this buffer as
your image!"

Anything? Any ideas? Thanks,
Brian

P.S. Although it shouldnt matter, I am using C# with .NET 2.0
 
Brian,

I don't think you 'll be able to tamper with the DOM of the document in
such a way in order to achieve the thing you want.

You could try to implement IDocHostUIHandler and TranslateUrl to point
to Isolated Storage (where I think you can write ...) for a given image
URL request.

hmmm... nothing better than that.

Regards,
Tasos
 
Well, I am really looking for any solution... through the DOM or not.

I have come across the concept of "Asynchronous Pluggable Protocols".
It seems as if I can register a protocol type (ex. MyProt) and register
my handlers for the protocol to return data through a memory interface.
Then, through the DOM, I think I can set the image source (ex.
img.source = "MyProt://ImageID=3344";) and my handler will return the
proper image.

Has anyone done this in C#? I think I will need to hook into some COM
interop... but I havent looked into it enough yet.
 
Hi All,

OLECMD_Paste ?

1. Copy image to clipboard memory
2. Navigate to insertion point in document
3. run WB.Exec OLECMD_Paste
 
That is a very interesting backup plan! I already have a working
mockup of Asynchronous Pluggable Protocols to load an image, and it
works really well. If I run into any snags, I will look into that
option, though I am not sure how reliable the method will be... since I
need to make sure the cursor is placed in exactly the correct place.

Thanks,
Brian
 
Back
Top