Listing A
// Set the color of the CNET Configuration static text
LRESULT SetTitleColor(HDC hDC, HWND hWnd)
{
    // Singleton instance of font
    static CFont fontTitle;
    static int bInit = true;

    // Create CDC and attach HDC to it
    CDC DC;
    DC.Attach(hDC);

    // If font has not been initialized, initialize it
    if(bInit)
    {
       // Create font for title
        CFont *pFont = CFont::FromHandle((HFONT)GetStockObject(SYSTEM_FONT));
        LOGFONT lf;
        pFont->GetLogFont(&lf);          // Retrieve default font
        lf.lfWeight = FW_BOLD;           // Make it bold
        lf.lfHeight = 13;                // Make it smaller       
        fontTitle.CreateFontIndirect(&lf);      // Create new font
        bInit = false;                   // Do not init again
    }

    // Set the current font and change the color to blue
    DC.SetTextColor(GetSysColor(COLOR_ACTIVEBORDER));
    DC.SelectObject(&fontTitle);

    // Return the background brush to erase with.
    return (LRESULT)GetStockObject(WHITE_BRUSH);
}