whojoedaddy
Programmer
Hi All, the simple code below doesn't seem to work. I'm trying to load a bitmap into a HDC and then check the pixel values in the HDC. It seem no matter where I do GetPixel it always comes back with 255. The image has varying colors, none of them 255, 255, 255. Any thoughts? I am not trying to load the values into the display (not yet anyway).
HDC hMemDC = CreateCompatibleDC(NULL);
HBITMAP hbmNewBitMap = (HBITMAP) LoadImage(NULL, "c:\\1.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
SelectObject(hMemDC, hbmNewBitMap);
COLORREF Color = GetPixel(hMemDC, 100, 100);
unsigned int R = GetRValue(Color);
unsigned int G = GetGValue(Color);
unsigned int B = GetBValue(Color);
HDC hMemDC = CreateCompatibleDC(NULL);
HBITMAP hbmNewBitMap = (HBITMAP) LoadImage(NULL, "c:\\1.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
SelectObject(hMemDC, hbmNewBitMap);
COLORREF Color = GetPixel(hMemDC, 100, 100);
unsigned int R = GetRValue(Color);
unsigned int G = GetGValue(Color);
unsigned int B = GetBValue(Color);