patcharats / tesseract-ocr

Automatically exported from code.google.com/p/tesseract-ocr
Other
0 stars 0 forks source link

How to port Tesseract engine into vb6 project? #42

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi All,

I have tried out to rebuild the tessdll to be used inside my vb6 project,
but  I have faced lot of problem including memory handling etc. Any
demonstration on how to utilize the dll interface into my vb6 project? So
far from the archive, i just can see the vc++ application testing out the
dll interface, how abt in vb6?

Original issue reported on code.google.com by slch2...@gmail.com on 16 Jul 2007 at 2:20

GoogleCodeExporter commented 9 years ago
What Declare statements are you using to access the DLL interface?

Original comment by ben%lidd...@gtempaccount.com on 6 Oct 2008 at 11:19

GoogleCodeExporter commented 9 years ago
Possible the problem is that the TessDLL functions are exported as __cdecl 
functions 
instead of __stdcall functions which VB6 requires.

Original comment by ben%lidd...@gtempaccount.com on 6 Oct 2008 at 11:21

GoogleCodeExporter commented 9 years ago

Original comment by theraysm...@gmail.com on 20 May 2010 at 6:50

GoogleCodeExporter commented 9 years ago
Personaly I call tesseract.exe from my VB.net Projects using this kind of code :

Imports System.IO
Imports System.Threading
Imports System.Collections.Specialized

Public class myClass

Private ProcessList As New Hashtable

Private Sub Button_Click(ByVal sender As System.Object, ByVal e As 
System.EventArgs) Handles Button.Click
    Dim croppedFile as String = "C:\image.tif"
    Dim OCRProcess As Process = New Process()
    OCRProcess.StartInfo.FileName = "C:\tesseract\tesseract.exe"
    OCRProcess.StartInfo.Arguments = croppedFile & " " & croppedFile & " -l eng"
    OCRProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
    OCRProcess.StartInfo.CreateNoWindow = True
    OCRProcess.EnableRaisingEvents = True
    AddHandler OCRProcess.Exited, AddressOf Me.ProcessExited
    OCRProcess.Start()
    ProcessList.Add(OCRProcess.Id.ToString, croppedFile & ".txt")
    Do While Not OCRProcess.HasExited
        Application.DoEvents()
    Loop
End Sub

Friend Sub ProcessExited(ByVal sender As Object, ByVal e As System.EventArgs)
    Dim Proc As DictionaryEntry
    Dim oRead As StreamReader
    Dim EntireFile As String = ""
    For Each Proc In ProcessList
        If (sender.id.ToString = Proc.Key) Then
            oRead = File.OpenText(Proc.Value)
            EntireFile = oRead.ReadToEnd()
        End If
    Next
    MsgBox(EntireFile)
End Sub

End Class

Original comment by regis.te...@gmail.com on 17 Nov 2010 at 1:54

GoogleCodeExporter commented 9 years ago
Reference to this issue was posted in FAQ

Original comment by zde...@gmail.com on 2 Jan 2013 at 12:44