It looks like you're inverting the values instead of scaling them up to a 0 to 255 range.
It seems to me...
instead of this:
HBRUSH brush = CreateSolidBrush( RGB(0xff >> red, 0xff >> green, 0xff >> blue) );
you want this:
HBRUSH brush = CreateSolidBrush( RGB(red << 5, green << 5, blue << 6) );