【例子介绍】引用AspriseOCR.dll验证码识别
【相关图片】
【源码结构】
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Edit1: TEdit; Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} function OCR(imgname:string;i:integer):PChar;stdcall; external 'AspriseOCR.dll'; procedure TForm1.Button1Click(Sender: TObject); var Vcode:PChar; Filename:string; VcodeStr:string; VcodePic:TFileStream; Htmlcode:string; begin try Vcode:=OCR('1.bmp',-1); finally VcodeStr := VcodeStr Vcode; VcodeStr := StringReplace(VcodeStr, 'O','0', [rfIgnoreCase]); Edit1.Text := VcodeStr; end; end; end.
评论