这个好像是因为有的窗口句柄得不到,不能取得所有的颜色,有什么办法能取得所有鼠标经过的点的颜色啊?

function GetPointColor(P: TPoint):TColor;
var
  V: TCanvas;
  C: TColor;
  H: HWND;
begin
  H := WindowFromPoint(P);
  V := TCanvas.Create;
  try
    V.Handle := GetDC(H);
    Result := V.Pixels[P.X, P.Y];
  finally
    V.Free;
  end;
end;