今天为了自动识别一个验证码,以前偷梁换柱的方法行不通了,从IE缓存里读取文件也行不通咯,看来只有用土办法了,我把你的验证码图片从屏幕上截下来,再对你进行OCR识别,看你还何话说。我想这个办法是没有办法中的办法,是万千办法中最强悍的办法,集老夫多年经验于一身,从大富翁论坛离线资料库查的,感谢大富翁,不过最近听说Delphi盒子要卖了,唉,世态炎凉啊,也不能怪站长,只能怪物价上涨,房价上涨,站长多年心血,唯一家产也就这个站了,希望能卖个好价钱,如果是我的话,卖了第一件事肯定是买套房子,
Use Jpeg
procedure TForm1.snapscreen(a,b,c,d:Integer);
var
bmpscreen:Tbitmap;
jpegscreen:Tjpegimage;
FullscreenCanvas:TCanvas;
dc:HDC;
sourceRect, destRect: TRect;
begin
try
dc:=getdc(0);
fullscreencanvas:=Tcanvas.Create;
fullscreencanvas.Handle:=dc;
bmpscreen:=Tbitmap.create;
bmpscreen.Width :=c-a;
bmpscreen.Height :=d-b;
sourcerect:=rect(0,0,c-a ,d-b );
destrect:= rect(a,b,c,d);
bmpscreen.Canvas.CopyRect(sourcerect,fullscreenCanvas,destrect);
jpegscreen:=Tjpegimage.Create ;
jpegscreen.Assign (bmpscreen);
jpegscreen.CompressionQuality:=100;
jpegscreen.SaveToFile(ExtractFilePath(ParamStr(0))+'tmp.jpg');
FullscreenCanvas.Free;
bmpscreen.Free;
jpegscreen.Free ;
ReleaseDC(0, DC);
except
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
snapscreen(self.Left,self.Top,Self.Left+self.Width,Self.Top+self.Height);
end;