views:

299

answers:

1

I wrote a small project that displays icons on the screen on WinCE. The icons are 28x28 16-color BMP files, placed in the main resource file (Resources.resx) (the resx for the main Form has the same problem, and GIF files don't work either).

The first time I try to get any bitmap from the resources, an exception of type Exception with Message "Exception" is thrown from Microsoft.AGL.Common.MISC.HandleAr, which was called from System.Drawing.Bitmap._InitFromMemoryStream.

I have two WinCE devices. This error only occurs on one of them; the other works fine. Other than this one problem, the app works on both devices. The app also uses some native code that involves DIBs, and that works fine. Any ideas?

Update: The same error occurs if I try to load a bitmap from a file. I also tried 1-bit (black & white), 8-bit and 24-bit bitmaps to no avail (WinCE framebuffers are most commonly 16-bit, but I have no image editor that can produce 16-bit bitmaps.)

A: 

I am having a similar problem and have been working on it for days. The next thing I am going to try is to store the bitmap as a DIB in the resource file, load it using LoadResource, convert it to a DDB by using GetCompatibleDC and "drawing" the DIB to the DC, that should create a DDB. I think the key is to use CreateCompatibleBitmap. I will report back on my findings.

Kevin H
I hope you're writing this in C#... I'm pretty sure a C# resource file is different than a C++ resource file.
Qwertie