Can you get the RGB value from HBRUSH
or from brush id? for example: I'm looking for GRAY_BRUSH
in RGB value.
Asked
Active
Viewed 3,176 times
2 Answers
1
static COLORREF lbColor;
HBRUSH hb = GetSysColorBrush(COLOR_BACKGROUND);
LOGBRUSH br = { 0 };
if (GetObject(hb, sizeof(br), &br))
{
lbColor = br.lbColor;
RGBQUAD rgbq = { 0 };
rgbq.rgbBlue = GetBValue(lbColor);
rgbq.rgbGreen = GetGValue(lbColor);
rgbq.rgbRed = GetRValue(lbColor);
rgbq.rgbReserved = 0;
//...
}

Khalfan Aziz
- 21
- 2
-
While this code may solve the question, [including an explanation](//meta.stackexchange.com/q/114762) of how and why this solves the problem would really help to improve the quality of your post, and probably result in more up-votes. Remember that you are answering the question for readers in the future, not just the person asking now. Please [edit] your answer to add explanations and give an indication of what limitations and assumptions apply. – Adrian Mole Aug 25 '22 at 11:05