delphi 调用modi的问题

取昵称麻烦 2010-08-02 03:02:15
我在网络上搜索到delphi调用modi的方法以及语句如下:
Try to use the Active X given with Microsoft Office named Microsoft Office Document Imaging.

1) Click menu "Component" > "Import ActiveX control".
2) Select the "Microsoft Office Document Imaging 11.0 Type Library"
3) Click "Create unit".

After doing so, the component will be in the ActiveX component page.

Add "ComObj, MODI_TLB" to the uses clause.

Drop "MiDocView" to the form.

procedure TForm.Button1Click(Sender: TObject);
Var
Img :IImage;
Layout :ILayout;
begin
doc := IDispatch(CreateOleObject('MODI.Document')) as IDocument;
doc.create('c:\test.bmp');
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;
问题是运行到doc.create('c:\test.bmp')的时候就提示“未注册类别”。
请教怎么解决?
...全文
312 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
老之 2010-08-02
  • 打赏
  • 举报
回复
好像是会报错的,以前我用过MODI来识别早期飞信的验证码, 那时候的代码我是这样写的:

doc := IDispatch(CreateOleObject('MODI.Document')) as IDocument;
try
doc.create(BmpFile);
except
doc.create(BmpFile);
end;

5,392

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧