COLORREF colorref; BYTE r,g,b; for(int i=0;i<20;i++) for(int j=0;j<20;j++) { colorref=GetPixel(hdc,i,j); r=GetRValue(colorref); g=GetGValue(colorref); b=GetBValue(colorref); CString str; str.Format("r=%d,g=%d,b=%d",r,g,b); m_Edit.SetWindowText(str); }