使用office2003带的ocr控件,在网上找到一段代码,但运行出错procedure TForm.Button1Click(Sender: TObject); 
Var 
  doc :IDocument; 
  Img :IImage; 
  Layout :ILayout; 
begin 
  doc := IDispatch(CreateOleObject('MODI.Document')) as IDocument; 
  doc.create(FileName);  // just put here the filename of an image 
  doc.OCR(miLANG_ENGLISH,true,true); 
  Img := IDispatch(doc.Images[0]) as IImage; 
  Layout := IDispatch(Img.Layout) as ILayout; 
  Memo1.Lines.Add(Layout.Text); 
  MiDocView1.Document := doc; 
  doc.Close(false); 
  Img := nil; 
  Layout := nil; 
end; http://www.delphi3000.com/articles/article_4253.asp运行后弹出错误对话框,提示:Object hasn't been initialized and can't be used yet
请问该如何解决?

解决方案 »

  1.   

    拟新建一个package 在add的时候选择import activeX,然后选择那个aceiveX,把组建安装上。我的office安装得不全,执行到这里提示安装一个东西,我这里进行不下去了
    doc.OCR(miLANG_ENGLISH,true,true); 
      

  2.   

    我也发现Microsoft Office Document Imaging安装不完全。但重装完整版的Office2003,发现并不能识别验证码。其中验证码已经经过灰度处理和中值滤波除噪,但MS Document Imaging不能识别。请教做过网页验证码识别程序的朋友,做这类程序的一般步骤是怎样的?