Given an HBRUSH or an HPEN, is there any function in GDI to find its color (if possible in a COLOREF) ?
Given an HBRUSH or an HPEN, is there any function in GDI to find its color (if possible in a COLOREF) ?
I think you can accomplish this using GetObject.
Code:COLORREF GetBrushColor( HBRUSH hBrush ) { COLORREF color = 0 ; LOGBRUSH logBrush ; if ( GetObject( hBrush, sizeof(LOGBRUSH), &logBrush ) ) { color = logBrush.lbColor ; } return color ; } COLORREF GetPenColor( HPEN hPen ) { COLORREF color = 0 ; LOGPEN logPen ; if ( GetObject( hPen, sizeof(LOGPEN), &logPen ) ) { color = logPen.lopnColor ; } return color ; }