Originally Posted by
ejohns85
I am trying to write some code to load a bitmap, so that I can retrieve its pixel data.
Are you just trying to display the bitmap to the screen? Or are you actually trying to look at individual pixel information?
Originally Posted by
ejohns85
What on earth does this mean? What is a handle? What is the executable file that it is talking about?
There are two ways to load a bitmap:
1. From a program resource.
- The bitmap is defined in a resource file (.rc) and is basically stored inside your .exe when compiled. Therefore when distributing your program you only have to give someone the .exe rather than the .exe + .bmp. Of course the .exe would be bigger in this case.
2. From a file on the hard drive (.bmp)
Ex of #1:
Code:
// This is file Resource.rc
deck_cards BITMAP Cards.bmp // Define a bitmap "Cards.bmp" with the ID of deck_cards.
Code:
// This is a .cpp file where all your other code is.
HBITMAP cardsBmp = LoadBitmap(instance, "deck_cards"); // Load bitmap from program resources rather than from hard drive.
Ex: #2 probably something like:
Code:
HBITMAP bmpCards = (HBITMAP)LoadImage(instance, "Cards.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);