如题,仅知道窗口句柄hWnd,窗口背景色如何获得?

解决方案 »

  1.   

    HDC hDC= ::GetDC(hWnd);
    if(NULL != hDC)
    {
        COLORREF color = GetBkColor(hDC);
        ::ReleaseDC(hWnd, hDC);
    }
      

  2.   

    COLORREF ref = FromHandle(hWnd)->GetDC()->GetBkColor();行吗?
      

  3.   

    CDC::GetBkColor
    This method retrieves the background color.COLORREF GetBkColor( )
    const; 
    Return Value
    An RGB color value.Res
    If the background mode is OPAQUE, the system uses the background color to fill the gaps in styled lines, the gaps between hatched lines in brushes, and the background in character cells. The system also uses the background color when converting bitmaps between color and monochrome device contexts