我想在webbrowser1中 遍历所有的 坐标点击 获取某一颜色值的坐标
for i :=0 to 500 do 
begin
for y:=0 to 500 do 
beign
 DC := GetDC(GetWindow(GetWindow(WebBrowser1.Handle,   GW_CHILD),   GW_CHILD));
  C := GetPixel(DC, myPoint.x, myPoint.y);
  //////Form1.Color := C;{在Form1上显示效果}
  ReleASEDC(GetWindow(GetWindow(WebBrowser1.Handle,   GW_CHILD),   GW_CHILD), DC);
  if s = '' then s := ColorToString(c);
  edit2.Text := s;
  if s='$00A63300' then
  begin
  showmessage(inttostr(ix))  ;
  showmessage(inttostr(iy));
  end;
end;
end;
可是这样运行起来 很卡 求解决方法
或者如何根据网页中的颜色 转换成 当前的颜色的坐标 X  Y  

解决方案 »

  1.   

    别遍历了,多慢,用个timer去吧,也可以用鼠标的钩子,给你timer的例子unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, ExtCtrls, OleCtrls, SHDocVw;type
      TForm1 = class(TForm)
        Timer1: TTimer;
        WebBrowser1: TWebBrowser;
        procedure Timer1Timer(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Timer1Timer(Sender: TObject);
    var
      p:TPoint;
      dc:HDC;
      i:Cardinal;
    begin
      GetCursorPos(p);
      dc := GetDC(0);
      i := GetPixel(dc,p.X,p.Y);
      if i = $00A63300 then
        ShowMessage('ok');
    end;end.