Avatar of designwitt
designwitt

asked on 

Modi onOCRProgress event not working

hello,
I wrote a vb app to OCR tiff images, i want to use the onOCRProgress event, but i cant get it to work, i ahve followed the documentation exactly and still cannot get it work, what do i need to do? here is my code, i want to upate the progress bar using the event, but cant figure it out, any samples would be great as well, this is what the documentation said to do:
Private Sub doc_onOCRProgress(byval progress as long)
     me.progressbar1.value = progress
end sub
 
'now i know that progress has to equal something, but what?

Open in new window

Visual Basic ClassicOCR

Avatar of undefined
Last Comment
designwitt
ASKER CERTIFIED SOLUTION
Avatar of game-master
game-master
Flag of Philippines image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of designwitt
designwitt

ASKER

How is ctr going to show the progress? And what are you declaring it as?

Thanks for the reply
Avatar of game-master
game-master
Flag of Philippines image



u can declare ctr as integer or long depending
on the size of you progress...

I think u must declare the ctr as long like
the way the progress was declared...

'add this line of code before the for next loop

Me.ProgressBar1.Max =  progress








***** the ctr value will going to be the progressbar value...


game-master
Avatar of designwitt
designwitt

ASKER

its not working, this is code, do you see anything wrong? it says in documentation that "progress" is supposed to be updated by the the onOCRprogress event, ive tried to follow the documentation ....
Option Explicit On
Imports System.Windows.Forms
Imports MODI
Public Class ocr
    Private WithEvents doc As MODI.Document
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim input As String = "c:\newtif.tif"
        doc = New MODI.Document
        doc.Create(input)
        Me.Cursor = Cursors.WaitCursor
        doc.OCR()
        doc.Save()
        Me.Cursor = Cursors.Default
        doc.Close()
        doc = Nothing
        MessageBox.Show("Optical Character Recognition Complete", "Conversion Complete", MessageBoxButtons.OK, MessageBoxIcon.Information)
        Me.Close()
    End Sub
    Private Sub Doc_OnOCRProgress(ByVal Progress As Long)
        Dim ctr As Long
        For ctr = 1 To Progress
            ProgressBar1.Value = ctr
        Next
        ProgressBar1.Maximum = Progress
    End Sub
End Class

Open in new window

Avatar of game-master
game-master
Flag of Philippines image



where is the part that your calling the  "Doc_OnOCRProgress'
on your onclik event?

can u send the documents that you followed?
Avatar of designwitt
designwitt

ASKER

here is the documentation that im following, i had to change some stuff to match my programming some, but its basically the same...
Option Explicit
Private WithEvents mmiDoc As MODI.Document
Private mblnCancel As Boolean
 
Private Sub cmdCancel_Click()
  
  ' Set a flag indicating that the user wants to cancel.
  mblnCancel = True
  
End Sub
 
Private Sub cmdOCR_Click()
 
  ' Load an existing TIF file.
  Set mmiDoc = New MODI.Document
  mmiDoc.Create "C:\document1.tif"
  
  ' Perform OCR on the document
  Screen.MousePointer = vbHourglass
  mmiDoc.OCR
  Screen.MousePointer = vbDefault
  
  Set mmiDoc = Nothing
  
End Sub
 
Private Sub mmiDoc_OnOCRProgress(ByVal Progress As Long, _
                                 Cancel As Boolean)
 
  ' Cancel if user has clicked the Cancel button.
  If mblnCancel Then
      Cancel = True
  End If
  
  ' Indicate progress on the ProgressBar control
  pbrOCRProgress.Value = Progress
  
End Sub

Open in new window

Avatar of game-master
game-master
Flag of Philippines image



i will be checking the documents as soon as
i've figure what went wrong....

but for now, ill be out on the office
so probably i can give u feedback
on monday..

Avatar of game-master
game-master
Flag of Philippines image



are you doing this in .net?
as i can i see, this document
was created in vb6...

is this really works for .net environment?
Avatar of designwitt
designwitt

ASKER

so far i have everything working for me right now in .net, the only thing that is not working is this onOCRprogress event, which is really important, haha, as usual, any ideas? what could progress be equal to so that it can update the progressbar?
Avatar of designwitt
designwitt

ASKER

please help i am still working on this, there has got to be a way to reference that control in this program, this is the only thing that i am lacking in my program, what do i need to switch since the sample was written in vb6?
Avatar of game-master
game-master
Flag of Philippines image



good morning!

I'm back at the office...
why not you do own progress bar?
if that is what u really want to have...


Avatar of designwitt
designwitt

ASKER

i would but i dont know how to set it up, how do you link a process like this to a progress bar?
Avatar of game-master
game-master
Flag of Philippines image


can u get the value the value of the progress?
the maximum value i mean?

Avatar of designwitt
designwitt

ASKER

i dont think so, i can get the total page numbers, but i was trying to find a way to get the amount of pages that are ocr'd so that i could maybe tie it to that, is there is another way to do this?
Avatar of designwitt
designwitt

ASKER

ok heres my idea, when i load the image to do the OCR, i can get the amount of pages, now if i do an ocr and find out the average time it takes to do a OCR for one page, can i tie that into a progress bar so that it is getting its value from those two varibles? am i on the right track?
Visual Basic Classic
Visual Basic Classic

Visual Basic is Microsoft’s event-driven programming language and integrated development environment (IDE) for its Component Object Model (COM) programming model. It is relatively easy to learn and use because of its graphical development features and BASIC heritage. It has been replaced with VB.NET, and is very similar to VBA (Visual Basic for Applications), the programming language for the Microsoft Office product line.

165K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo