This...
Code:
GetCursorPos(&Mouse);						
Colors = GetPixel(GetWindowDC(ChildWindowFromPoint(WindowFromPoint(Mouse), Mouse)), Mouse.x, Mouse.y);
			
Red = GetRValue(Colors);
Green = GetGValue(Colors);
Blue = GetBValue(Colors);
				
SetDlgItemInt(hMainDialog, ID_EDIT_RED, Red, FALSE);
SetDlgItemInt(hMainDialog, ID_EDIT_GREEN, Green, FALSE);
SetDlgItemInt(hMainDialog, ID_EDIT_BLUE, Blue, FALSE);
Or
This...
Code:
GetCursorPos(&Mouse);
Window = WindowFromPoint(Mouse);
Window = ChildWindowFromPoint(Window, Mouse);
Hdc = GetWindowDC(Window);
					
Colors = GetPixel(Hdc, Mouse.x, Mouse.y);

//Extract RGB values
Red = GetRValue(Colors);
Green = GetGValue(Colors);
Blue = GetBValue(Colors);

//Set the edit boxes
SetDlgItemInt(hMainDialog, ID_EDIT_RED, Red, FALSE);
SetDlgItemInt(hMainDialog, ID_EDIT_GREEN, Green, FALSE);
SetDlgItemInt(hMainDialog, ID_EDIT_BLUE, Blue, FALSE);