COLORREF color = RGB(255, 0, 0);
CColorDialog cdlg(color);
if (IDOK == cdlg.DoModal())
{
color = cdlg.GetColor();
CString str;
str.Format(_T("%d"), GetRValue(color));
GetDlgItem(IDC_EDIT2)->SetWindowTextW(str);
str.Format(_T("%d"), GetGValue(color));
GetDlgItem(IDC_EDIT3)->SetWindowTextW(str);
str.Format(_T("%d"), GetBValue(color));
GetDlgItem(IDC_EDIT4)->SetWindowTextW(str);
}