Click here to Skip to main content
15,891,943 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Please what is the RGB clour code for usual windows dialogue back ground.
I am writing a windows routine in which I need to select a text background that matches
the dialogue box colour, but I do not know the RGB colour code for it. Can any one help me?
Posted
Updated 7-Aug-11 23:45pm
v2

GetSysColor(COLOR_BTNFACE)

Regards.
 
Share this answer
 
Comments
Richard MacCutchan 9-Aug-11 7:58am    
I think you can also use CTLCOLOR_DLG, although it is not the same as COLOR_BTNFACE.
mbue 9-Aug-11 14:29pm    
See my statement at solution 3. ;)
CTRL-Printscreen to grab a screen shot. Paint will then let you work out your color values. Paint.NET will give them to you in hex.
 
Share this answer
 
mbue's response works most of the time... in cases when you're not using a standard color... you can do the following:
//Extract window background color
CDC *wndDC = m_WndofInterest->GetDC(); //Get a DC to the wnd of interest
COLORREC wndBK = wndDC->GetPixel(0,0); //Get color of a pixel (origin here)
ReleaseDC(wndDC);                      //Done, release DC
 
Share this answer
 
Comments
mbue 8-Aug-11 16:21pm    

HDC hdc = GetDC(hDlg);
HBRUSH hbr = (HBRUSH)SendMessage(hDlg,WM_CTLCOLORDLG,(WPARAM)hdc,(LPARAM)hDlg);
LOGBRUSH logb;

ReleaseDC(hDlg,hdc);

if(GetObject(hbr,sizeof(logb),&logb))
{
logb.lbColor; // <- here is the color
}
The RGB code for default windows dialogue background color is RGB(235,233,237)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900