Re: Out of memory exception loading a bitmap from a stream
- From: "Rick Spiewak" <rickspiewak@xxxxxxxxxxxxxx>
- Date: Wed, 12 Apr 2006 21:38:14 -0400
It's an icon file as a resource.
Yes, later I'll modify the code to construct the correct name - the code I
posted is what I've been trying to get working as a test - but it needs to
be working first. Any ideas?
"Alex Feinman [MVP]" <public_news@xxxxxxxxxxxxxxx> wrote in message
news:ul0$iDnXGHA.1204@xxxxxxxxxxxxxxxxxxxxxxx
Your stream is called IconStream. Is it an icon file indeed, or just a
misnomer?
Also, avoid using resources by index. You never know which one you are
actually loading. Use the actual name
"Rick" <rickspiewak@xxxxxxxxxxxxxx> wrote in message
news:1144873910.849287.64730@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I'm trying to extract an icon from a resource in a dll. The following
sequence:
Dim MyAssemblies() As [Assembly]
.
.
ResourceNames = MyAssemblies(i).GetManifestResourceNames
IconStream = _
MyAssemblies(i).GetManifestResourceStream(ResourceNames(0))
Dim Icon As New Bitmap(IconStream)
Results in an exception:
System.OutOfMemoryException was unhandled
Message="OutOfMemoryException"
StackTrace:
at Microsoft.AGL.Common.MISC.HandleAr()
at System.Drawing.Bitmap._InitFromMemoryStream()
at System.Drawing.Bitmap..ctor()
at ...(Application stack trace)
There is plenty of both storage and program memory left on the device,
and the stream (IconStream) is small (length = 1078). Any ideas? Should
I just punt and put the icon in a file? (not as general)
.
- Follow-Ups:
- Re: Out of memory exception loading a bitmap from a stream
- From: Alex Feinman [MVP]
- Re: Out of memory exception loading a bitmap from a stream
- References:
- Out of memory exception loading a bitmap from a stream
- From: Rick
- Re: Out of memory exception loading a bitmap from a stream
- From: Alex Feinman [MVP]
- Out of memory exception loading a bitmap from a stream
- Prev by Date: Re: Vs2005 to PDA to Rs232 interface
- Next by Date: Disable hardware buttons from turning on the device
- Previous by thread: Re: Out of memory exception loading a bitmap from a stream
- Next by thread: Re: Out of memory exception loading a bitmap from a stream
- Index(es):