::SelectObject(theHDC, result);
SolidBrushCache::GetSolidBrush(COLORREF aColor){  int     i;  HBRUSH  result = NULL;    // See if it's already in the cache  for (i = 0; (i < BRUSH_CACHE_SIZE) && mCache[i].mBrush; i++) {    if (mCache[i].mBrush && (mCache[i].mBrushColor == aColor)) {      // Found an existing brush      result = mCache[i].mBrush;      break;    }  }  if (!result) {    // We didn't find it in the set of existing brushes, so create a    // new brush    result = (HBRUSH)::CreateSolidBrush(PALETTERGB_COLORREF(aColor));    // If there's an empty slot in the cache, then just add it there    if (i >= BRUSH_CACHE_SIZE) {      // Nope. The cache is full so we need to replace the oldest entry      // in the cache      ::DeleteObject(mCache[mIndexOldest].mBrush);      i = mIndexOldest;      if (++mIndexOldest >= BRUSH_CACHE_SIZE) {        mIndexOldest = 2;      }    }    // Add the new entry    mCache[i].mBrush = result;    mCache[i].mBrushColor = aColor;  }  return result;}