Click here to Skip to main content
15,921,577 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hi ,

I am trying to retrieve the text for an scanned image by adding the refernce "MDIVWCTL.DLL" to my Vb.Net project.(2008 Standard Edition)

While executing the code i get error at mt Create statement:- I get the 'System.Runtime.InteropServices.COMException'

VB
Dim ModiDoc As New MODI.Document
Dim sPath As String : sPath = "C:\SingleImage.tiff"

ModiDoc.Create(sPath)
ModiDoc.OCR(MODI.MiLANGUAGES.miLANG_ENGLISH, False, False)
MsgBox(ModiDoc.Images.Count)


Note :- the Microsoft Image scanning 2007 with OCR is already installed in my system.

Will aprreciate if can get a quick response to my issue :)
Posted
Updated 18-Sep-13 11:01am
v2
Comments
Bernhard Hiller 19-Sep-13 2:34am    
"COMException" is not exact - please give more info (e.g. COM error code, COM error message).
By the way, do you have write access to C:\? - That's not a good location for files.
Member 10277265 20-Sep-13 9:02am    
The issue got resolved. Actually i had written wrong extension ".tiff" instead of ".tif" :)
Member 10277265 19-Sep-13 9:27am    
Thanks for the reply.

I am executing the code from D:\ Drive and not C:\. PFB, the Exception trace:-

System.Runtime.InteropServices.COMException was unhandled
ErrorCode=-959966950
Message - "IO error"
Error Message="IO error"
Source=""
StackTrace:
at MODI.DocumentClass.Create(String FileOpen)
at WindowsApplication1.Form1.Button1_Click(Object sender, EventArgs e) in D:\RetrieveTextFromScannedImage\RetrieveTextFromScannedImage\Form1.vb:line 7
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at WindowsApplication1.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:


Please let me know if you need any specific info

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900