Hi all,

I have a dll which contains five resource images (gif and png) as
embedded resource, I am loading these resources from the dll into my main
application, I get all the resource names correctly from the resource dll
... after constructing 2 bitmaps this piece of code throws exception.

The exception stacttrace is

at Microsoft.AGL.Common.MISC.HandleAr(PAL_ERROR ar)
at System.Drawing.Bitmap._InitFromMemoryStream(MemoryStream mstream)
at System.Drawing.Bitmap..ctor(Stream stream)
at MELFO_eLearning.MainForm..ctor()
at MELFO_eLearning.Program.Main()



Code:

Assembly asm = Assembly.LoadFrom("appres.dll");

string[] resNames = asm.GetManifestResourceNames();

Bitmap[] resBmps = new Bitmap[resNames.Length];

for (int i = 0; i < resNames.Length; i++)

{

try

{

Stream stream = asm.GetManifestResourceStream(resNames[i]);

resBmps[i] = new Bitmap(stream);

}

catch (Exception ex)

{

MessageBox.Show(ex.StackTrace);

}

}





Any ideas, please ????

Re: GetManiestResourseStream() and exception by ctacke/>

ctacke/>
Tue Mar 04 11:32:15 CST 2008

What kind of exception is it throwing? What is the exception message?


--

Chris Tacke, eMVP
Join the Embedded Developer Community
http://community.opennetcf.com


"Saju Sathyan" <saju_sathyan@hotmail.com> wrote in message
news:uWuRZ0hfIHA.2268@TK2MSFTNGP02.phx.gbl...
> Hi all,
>
> I have a dll which contains five resource images (gif and png) as
> embedded resource, I am loading these resources from the dll into my main
> application, I get all the resource names correctly from the resource dll
> ... after constructing 2 bitmaps this piece of code throws exception.
>
> The exception stacttrace is
>
> at Microsoft.AGL.Common.MISC.HandleAr(PAL_ERROR ar)
> at System.Drawing.Bitmap._InitFromMemoryStream(MemoryStream mstream)
> at System.Drawing.Bitmap..ctor(Stream stream)
> at MELFO_eLearning.MainForm..ctor()
> at MELFO_eLearning.Program.Main()
>
>
>
> Code:
>
> Assembly asm = Assembly.LoadFrom("appres.dll");
>
> string[] resNames = asm.GetManifestResourceNames();
>
> Bitmap[] resBmps = new Bitmap[resNames.Length];
>
> for (int i = 0; i < resNames.Length; i++)
>
> {
>
> try
>
> {
>
> Stream stream = asm.GetManifestResourceStream(resNames[i]);
>
> resBmps[i] = new Bitmap(stream);
>
> }
>
> catch (Exception ex)
>
> {
>
> MessageBox.Show(ex.StackTrace);
>
> }
>
> }
>
>
>
>
>
> Any ideas, please ????
>
>
>



Re: GetManiestResourseStream() and exception by Saju

Saju
Tue Mar 04 15:43:32 CST 2008

It is just "Exception"... that is all I get... it doesn't throw any
documented exceptions which are shown in the msdn for
GetManifestResourceStream function.


"<ctacke/>" wrote in message
> What kind of exception is it throwing? What is the exception message?
>
>
> --
>
> Chris Tacke, eMVP
> Join the Embedded Developer Community
> http://community.opennetcf.com
>
>
> "Saju Sathyan" <saju_sathyan@hotmail.com> wrote in message
> news:uWuRZ0hfIHA.2268@TK2MSFTNGP02.phx.gbl...
>> Hi all,
>>
>> I have a dll which contains five resource images (gif and png) as
>> embedded resource, I am loading these resources from the dll into my main
>> application, I get all the resource names correctly from the resource dll
>> ... after constructing 2 bitmaps this piece of code throws exception.
>>
>> The exception stacttrace is
>>
>> at Microsoft.AGL.Common.MISC.HandleAr(PAL_ERROR ar)
>> at System.Drawing.Bitmap._InitFromMemoryStream(MemoryStream mstream)
>> at System.Drawing.Bitmap..ctor(Stream stream)
>> at MELFO_eLearning.MainForm..ctor()
>> at MELFO_eLearning.Program.Main()
>>
>>
>>
>> Code:
>>
>> Assembly asm = Assembly.LoadFrom("appres.dll");
>>
>> string[] resNames = asm.GetManifestResourceNames();
>>
>> Bitmap[] resBmps = new Bitmap[resNames.Length];
>>
>> for (int i = 0; i < resNames.Length; i++)
>>
>> {
>>
>> try
>>
>> {
>>
>> Stream stream = asm.GetManifestResourceStream(resNames[i]);
>>
>> resBmps[i] = new Bitmap(stream);
>>
>> }
>>
>> catch (Exception ex)
>>
>> {
>>
>> MessageBox.Show(ex.StackTrace);
>>
>> }
>>
>> }
>>
>>
>>
>>
>>
>> Any ideas, please ????
>>
>>
>>
>
>



Re: GetManiestResourseStream() and exception by Saju

Saju
Tue Mar 04 16:13:00 CST 2008

The exception is a type of Exception and it gives the message "Exception" as
the message. Nothing more than that...


"Saju Sathyan" wrote in message
> It is just "Exception"... that is all I get... it doesn't throw any
> documented exceptions which are shown in the msdn for
> GetManifestResourceStream function.
>
>
> "<ctacke/>" wrote in message
>> What kind of exception is it throwing? What is the exception message?
>>
>>
>> --
>>
>> Chris Tacke, eMVP
>> Join the Embedded Developer Community
>> http://community.opennetcf.com
>>
>>