Oct 31st, 2000, 06:29 PM
This...
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...
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);
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...
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);