Click here to Skip to main content
15,893,564 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Third time I am posting please annswer Pin
kakan6-Nov-05 19:56
professionalkakan6-Nov-05 19:56 
AnswerRe: Third time I am posting please annswer Pin
David Crow7-Nov-05 3:08
David Crow7-Nov-05 3:08 
Question32 or 16 bit color icons for Visual C++ 6.0 Pin
haputanlas6-Nov-05 13:16
haputanlas6-Nov-05 13:16 
AnswerRe: 32 or 16 bit color icons for Visual C++ 6.0 Pin
LighthouseJ6-Nov-05 17:23
LighthouseJ6-Nov-05 17:23 
GeneralRe: 32 or 16 bit color icons for Visual C++ 6.0 Pin
haputanlas6-Nov-05 19:03
haputanlas6-Nov-05 19:03 
AnswerRe: 32 or 16 bit color icons for Visual C++ 6.0 Pin
ThatsAlok6-Nov-05 17:29
ThatsAlok6-Nov-05 17:29 
AnswerRe: 32 or 16 bit color icons for Visual C++ 6.0 Pin
Taka Muraoka7-Nov-05 0:17
Taka Muraoka7-Nov-05 0:17 
QuestionHBITMAPS and pixels Pin
BBJ_NYC6-Nov-05 9:33
BBJ_NYC6-Nov-05 9:33 
Hi I’ve been trying to write a routine that will scan 1 bitmap to see if a second bitmap is within it. I’m not having a problem with the algorithm to do the search I’m having problems getting the pixel colors from both the bitmaps. For testing I loaded the first image by calling ::LoadImage() which returns an HBITMAP. For the second image I’m loading into I.E. and using some code to get the hwnd and pull the HBITMAP calling CopyWindowToBitmap().

So now that I have 2 variables of type HBITMAP. How do I get there pixels?

This is what I’ve tried with no success.
HBITMAP bmpOne;
HBITMAP bmpTwo;
… Some code to get bmpOne and bmpTwo ..

HDC hDC = ::GetDC(NULL);
HDC hDCBMPOne = ::CreateCompatibleDC(hDC);
HDC hDCBMPTwo = ::CreateCompatibleDC(hDC);

::SelectObject(hDCBMP1 , bmpOne);
::SelectObject(hDCBMP2 , bmpTwo);

COLORREF PixelOne;
COLORREF dPixelTwo;

PixelOne = ::GetPixel(hDCBMPOne, x, y);
PixelTwo = ::GetPixel(hDCBMPTwo, x, y);


If I do the following…
int red = GetRValue(PixelOne);
int green = GetGValue(PixelOne);
int blue = GetBValue(PixelOne);

Even though the color at x,y is not white I always get
red = 255, green= 255 and blue = 255;

I know that the HBITMAP bmpOne and bmpTwo are loaded because I display them in a dialog.

Any thoughts? Is there a way to get the pixel data directly from HBITMAP? Thanks.

AnswerRe: HBITMAPS and pixels Pin
Ravi Bhavnani6-Nov-05 11:40
professionalRavi Bhavnani6-Nov-05 11:40 
AnswerRe: HBITMAPS and pixels Pin
Christian Graus6-Nov-05 12:01
protectorChristian Graus6-Nov-05 12:01 
GeneralRe: HBITMAPS and pixels Pin
Jörgen Sigvardsson6-Nov-05 12:21
Jörgen Sigvardsson6-Nov-05 12:21 
QuestionIsKindOf detection Pin
LighthouseJ6-Nov-05 7:30
LighthouseJ6-Nov-05 7:30 
AnswerRe: IsKindOf detection Pin
Ravi Bhavnani6-Nov-05 9:22
professionalRavi Bhavnani6-Nov-05 9:22 
AnswerRe: IsKindOf detection Pin
S. Senthil Kumar7-Nov-05 2:22
S. Senthil Kumar7-Nov-05 2:22 
QuestionLoading resources? Pin
Lord Kixdemp5-Nov-05 23:12
Lord Kixdemp5-Nov-05 23:12 
AnswerRe: Loading resources? Pin
BadKarma5-Nov-05 23:21
BadKarma5-Nov-05 23:21 
AnswerRe: Loading resources? Pin
qfegd6-Nov-05 1:43
qfegd6-Nov-05 1:43 
AnswerRe: Loading resources? Pin
Ravi Bhavnani6-Nov-05 2:29
professionalRavi Bhavnani6-Nov-05 2:29 
GeneralRe: Loading resources? Pin
Lord Kixdemp6-Nov-05 9:11
Lord Kixdemp6-Nov-05 9:11 
GeneralRe: Loading resources? Pin
Ravi Bhavnani6-Nov-05 9:17
professionalRavi Bhavnani6-Nov-05 9:17 
GeneralRe: Loading resources? Pin
Lord Kixdemp6-Nov-05 9:42
Lord Kixdemp6-Nov-05 9:42 
GeneralRe: Loading resources? Pin
Ravi Bhavnani6-Nov-05 9:48
professionalRavi Bhavnani6-Nov-05 9:48 
GeneralRe: Loading resources? Pin
Lord Kixdemp6-Nov-05 10:28
Lord Kixdemp6-Nov-05 10:28 
GeneralRe: Loading resources? Pin
Ravi Bhavnani6-Nov-05 11:37
professionalRavi Bhavnani6-Nov-05 11:37 
GeneralRe: Loading resources? Pin
Lord Kixdemp6-Nov-05 12:34
Lord Kixdemp6-Nov-05 12:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.