By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,335 Members | 1,310 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,335 IT Pros & Developers. It's quick & easy.

Remoting Bitmaps and Sound files

P: n/a
Hi, I'm looking for a way to remotely pass bitmaps and soundfiles via remoting. I have a class which contains a bitmap and I can easily access it remotely as long as I do not set a value for the bitmap. However, when i specify a value for the bitmap I get the 'Because of security restrictions, the type System.Runtime.Remoting.ObjRef cannot be accessed.' message. Now, I attempted to inherit from Bitmap to make it serializable but I am unable to inherit from that class. If anyone knows how to serialize a bitmap across the remoting boundary, your help would be greatly appreciated!

Thanks,
Tim
Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Tim,

With a Bitmap, you can call the Save method on it to write to a Stream.
I would pass a MemoryStream to this method, and then extract the byte array
from the memory stream, sending that across the remoting boundary.

Then, on the other side, when you get the byte array, you can call the
static FromStream method on the Image class to get an instance of Image that
you can probably cast to Bitmap (depending on whether the underlying
representation was Bitmap or a Metafile).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Tim Shih" <ts***@sensicast.com> wrote in message
news:e8****************@TK2MSFTNGP12.phx.gbl...
Hi, I'm looking for a way to remotely pass bitmaps and soundfiles via
remoting. I have a class which contains a bitmap and I can easily access it
remotely as long as I do not set a value for the bitmap. However, when i
specify a value for the bitmap I get the 'Because of security restrictions,
the type System.Runtime.Remoting.ObjRef cannot be accessed.' message. Now, I
attempted to inherit from Bitmap to make it serializable but I am unable to
inherit from that class. If anyone knows how to serialize a bitmap across
the remoting boundary, your help would be greatly appreciated!

Thanks,
Tim
Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.