All Forums
 Microsoft Windows CE
 eVC Application Development
 Displaying a .bmp or .jpg file in CE
 Forum Locked
 Send Topic to a Friend
 Printer Friendly
Author Topic  

rpizzo

24 Posts

Posted - 08 Aug 2006 :  09:31:34  Show Profile  Email Poster
Hello,
I am having more trouble than I think I should with trying to display a small .bmp file in a section of a dialog box.
I am using the BitsyX with Windows CE, NOT .NET.
Apparently, SHLoadImageFile() is only a .NET supported function?
Anyhow, does anyone know what the code should look like to load a .bmp file and draw it into a section of dialog box client area? Picturebox, static, or no control?

Thanks..Any help would be greatly appreciated. This is the last software stumbling block I have on this project!

ctacke

877 Posts

Posted - 08 Aug 2006 :  09:39:17  Show Profile  Email Poster
SHLoadImageFile is a Windows Mobile/Pocket PC API. Try using SHLoadDIBitmap.
Go to Top of Page

rpizzo

24 Posts

Posted - 08 Aug 2006 :  10:06:42  Show Profile  Email Poster
Looks like SHLoadDIBitmap() is also only .NET supported. Can I use .NET on my BitsyX? If not my only possible solution is to write it differently rather than use a nice API function :(
Can you show me how to move from embedded vc++ 4.0, Windows CE 4.1, to a .NET world for BitsyX?
Go to Top of Page

ctacke

877 Posts

Posted - 08 Aug 2006 :  10:37:00  Show Profile  Email Poster
Not sure what you mean by "only .NET supported." .NET is a terribly confusing moniker, as CE 4.0, 4.1 and 4.2 were all branded as "CE .NET" yet only CE 4.1 and later supports the .NET Compact Framework.

At any rate, it's not a managed API, it's supported as a standard shell function in CE 3.0 and later (maybe earlier, but I'm not certain). It can be called right from C/C++ code, so something like this should work (I typed this right into this page, so keep in mind it's not tested, compiled, or anything):


// load the bitmap
HBITMAP bmp = SHLoadDIBitmap(_T("\\FlashFX Disk\\myimage.bmp"));

// get the DC for the window on which to draw
// you have to have created a windows somewhere to pass in the handle here
HDC windowDC = GetDC(hWindowHandle);

// create a compatible DC with it
HDC drawingDC = CreateCompatibleDC(windowDC);

// select the bitmap into it
HBITMAP oldBMP = SelectObject(drawingDC, bmp);

// how big is the bitmap we loaded?
BITMAP b;
GetObject(bmp, sizeof(BITMAP), &b);

// blit the image to the window
BitBlt(windowDC, 0, 0, b.bmWidth, b.bmHeight, drawingDC, 0, 0,
SRCCCOPY);

// now clean up to prevent leaks
SelectObject(drawingDC, oldBMP);
DeleteDC(drawingDC);
DeleteObject(bmp);


Go to Top of Page
  Topic  
 Forum Locked
 Send Topic to a Friend
 Printer Friendly
Jump To:
Eurotech Support Forums © Eurotech Inc. Go To Top Of Page
This page was generated in 0.02 seconds. Snitz Forums 2000