procedure TForm1.Timer1Timer(Sender: TObject);
var DC : HDC;
AColor :
Array[1..4]
of Byte;
TheWindowHandle: THandle;
aRect: TRect;
ergebnisX, ergebnisY : integer;
begin
DC:=CreateDC('
DISPLAY',
NIL,
NIL,
NIL);
DWord(AColor) := GetPixel(
dc,Mouse.CursorPos.X,Mouse.CursorPos.Y);
DeleteDC(
dc);
Label1.Caption := '
R: ' + IntToStr(AColor[1]) + '
; ' +
'
G: ' + IntToStr(AColor[2]) + '
; ' +
'
B: ' + IntToStr(AColor[3]) + '
; ' +
'
Hex: ' + IntToHex(DWord(AColor),6);
Label4.Caption := '
TColor: $'+IntToHex(DWord(AColor),8);
Label2.Caption := '
X: ' + IntToStr(Mouse.CursorPos.X);
Label3.Caption := '
Y: ' + IntToStr(Mouse.CursorPos.Y);
TheWindowHandle := FindWindow('
xxxxx','
xxxxx');
GetWindowRect(TheWindowHandle, ARect);
label5.Caption := '
X: '+ IntToStr(aRect.Left);
label6.Caption := '
Y: '+ IntToStr(aRect.Top);
ergebnisX := Mouse.CursorPos.X - aRect.Left;
label7.Caption := '
X: ' + IntToStr(ergebnisX);
ergebnisY := Mouse.CursorPos.Y - aRect.Top;
label8.Caption := '
Y: ' + IntToStr(ergebnisY);
end;