[API]
RECT
CreateSolidBrush
DeleteObject
FillRect
GetSysColor
SelectObject

[CODE]
Public Function DC_FillIndirectRGB(ByVal hDC As Long, ByVal Width As Long, ByVal Height As Long, ByVal Color As ColorConstants) As Boolean
  Dim hBrush As Long
  Dim hBrushOld As Long
  Dim xType1 As RECT
  
  xType1.Right = Width - 1&
  xType1.Bottom = Height - 1&
  If Color < 0& Then
    If (Color And &H70000000) Then
      FillIndirectRGB = Not (FillRect(hDC, xType1, GetSysColor(-Color)) = 0&)
      Else
      FillIndirectRGB = Not (FillRect(hDC, xType1, GetSysColor(Color And &H3FFFFFFF)) = 0&)
      End If
    Else
    hBrush = CreateSolidBrush(Color)
    If Not hBrush = 0& Then
      hBrushOld = SelectObject(hDC, hBrush)
      If Not hBrushOld = 0& Then
        FillIndirectRGB = Not (FillRect(hDC, xType1, hBrush) = 0&)
        Call SelectObject(hDC, hBrushOld)
        End If
      Call DeleteObject(hBrush)
      End If
    End If
  End Function
