Author |
Topic |
|
rpizzo
24 Posts |
Posted - 08 Aug 2006 : 09:31:34
|
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
|
SHLoadImageFile is a Windows Mobile/Pocket PC API. Try using SHLoadDIBitmap. |
|
|
rpizzo
24 Posts |
Posted - 08 Aug 2006 : 10:06:42
|
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? |
|
|
ctacke
877 Posts |
Posted - 08 Aug 2006 : 10:37:00
|
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);
|
|
|
|
Topic |
|
|
|