onlyou13

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
var
  mStream: TMemoryStream;
  vcode: array[0..49] of AnsiChar;
  buffer: array of AnsiChar;
begin
  mStream := TMemoryStream.Create;
  mStream.LoadFromFile('1.png');

  //GetMem(vcode, 50);
  ShowMessage('1');
  SetLength(buffer, mStream.Size);
  mStream.Position := 0;
  ShowMessage('2');
  mStream.ReadBuffer(buffer[0], mStream.Size);
  ShowMessage('3');

  //if GetCodeText(buffer, mStream.Size, '输入前4位图像校验码', vcode) then               //第一种
  if GetCodeText(Integer(@buffer[0]), mStream.Size, '输入前4位图像校验码', vcode) then    //第二种
    Edit1.Text := Format('识别成功:%s', [string(vcode)])
  else
    Edit1.Text := '识别失败';
  ShowMessage('4');

  mStream.Free;
end;

 

posted on 2019-01-23 20:45  onlyou13  阅读(212)  评论(0编辑  收藏  举报