procedure TFmain.Button3Click(Sender: TObject);
var
WindowHandle : HWND;
DC : HDC;
Rect : TRect;
Bmp : TBitmap;
r, c : integer;
result:boolean;
begin
WindowHandle:=FindAWindow('
ICQ', '
');
if WindowHandle <> 0
then
begin
bsSkinMessage1.MessageDlg('
ICQHandle found!',
mtInformation, [mbOK], 0);
DC := GetWindowDc(WindowHandle);
GetWindowRect(WindowHandle, Rect);
Bmp := TBitmap.Create;
//Bmp.Pixelformat := pf8bit;
Bmp.Width := Rect.Right - Rect.Left;
Bmp.Height := Rect.Bottom - Rect.Top;
BitBlt(Bmp.Canvas.Handle, 0, 0, Bmp.Width, Bmp.Height,
DC, 0, 0, SRCCOPY);
ReleaseDc(WindowHandle,
DC);
// Hier dann Funktion zum Durchsuchen des Bitmap aufrufen...
bsSkinMessage1.MessageDlg('
Searching Bitmap!',
mtInformation, [mbOK], 0);
result:=FALSE;
r := 0;
while (r < Bmp.Height)
and not result
do
begin
c := 0;
while (c < Bmp.Width)
and not result
do
begin
if Bmp.Canvas.Pixels[c, r] =
RGB(128,224,255)
then
//oder mit $HEX ^^
begin
showmessage('
color found');
l_x.Caption := IntToStr(c + Rect.left + 10);
l_y.Caption := IntToStr(r + Rect.Top + 10);
result := True;
end;
inc(c);
end;
inc(r);
end;
Bmp.Free;
end
else
begin
bsSkinMessage1.MessageDlg('
ICQ Handle not found!',
mtError, [mbOK], 0);
end;
end;