读书人

MiDocView控件有关问题

发布时间: 2012-03-29 12:53:13 作者: rapoo

MiDocView控件问题
使用office2003带的ocr控件,在网上找到一段代码,但运行出错

Delphi(Pascal) code
 
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
请问该如何解决?


[解决办法]
用C++来做吧

读书人网 >.NET

热点推荐