Using printf to print a COLORREF type variable
I need to 开发者_高级运维print a variable which is a COLORREF.
You might also want to break it up into the individual RGB components:
printf("R: %i, G: %i, B: %i", GetRValue(color), GetGValue(color), GetBValue(color));
this would give you something like:
R: 255, G: 150, B: 75
A COLORREF
is just an integer containing an RGB value. You can print a hex representation this way:
printf("%06X", color);
Note that the order of values is bbggrr
, so it will look different from the usual rrggbb
format.
精彩评论