ImageControls

 

ImageControls 3 Application Note

IC Toolkit 3.1 is the most recent release of the ImageControls Toolkit.


If you are running a previous version of Kofax ImageControls, refer to the ImageControls How to Buy Web page for details on how to obtain the appropriate ImageControls 3 release for your configuration.


Frequency of Display While Scanning/Importing

ImageControls 3 provides the capability to display all images while they are being scanned. This is normally accomplished by connecting the KView to the KScan controls, and automatically displaying the scanned or imported image. But, the displaying of images as they are being scanned or imported can negatively impact the ImageControls scan process. As an alternative to displaying all images as they are processed, a developer can control the frequency which processed images are displayed. For example, instead of displaying each and every image as it is processed, the user may only wish to see every five (5) images processed. This is outlined in the ImageControls 3 Programmer's Guide, Chapter 4 Scanning and Importing Images, the section Programmatic Control Over the Frequency of the Display.

This project modifies the original demonstration utility, VBDEM32x.EXE, source code as provided with the ImageControls 3 Toolkit. It provides the ability to alter the frequency at which processed images are displayed. The user would select a number between "0" and "9" inclusive. A zero (0) would denote the deactivation of any display of processed images. A one (1) would denote that all images processed are to be displayed. A two (2) would denote that every other image processed be displayed and so on.

It contains one additional form, frmDisplayFreq, which is a dialog box to select frequency at which images will be displayed. This form consists of the following:

Figure 1 displays the placement of these items on the form.

 

Figure 1

A menu selection, mnuSourceDisplayFreq, was added after the Batch Processing menu item in the Source pull down menu of the main form, frmMain. When it is selected, the form frmDisplayFreq is displayed. When the user closes the dialog box, it is unloaded.

Private Sub mnuSourceDisplayFreq_Click()

 

'***** Display Frequency dialog box

Call KFShowFormWithHourGlass(frmDisplayFreq, True)

'***** Hide the form

Unload frmDisplayFreq

End Sub

The user is able to select the frequency in which the images will be displayed during processing. When the form loads, it centers itself and puts the dialog box on top. The initial value is derived from a global variable, g_DisplayFreq.

Private Sub Form_Load()

'***** Center box.

KFCenterForm Me

'***** Put box on top

KFPutFormOnTop Me

'***** Initial Value for display frequency.

txtDisplayFreq.Text = g_DisplayFreq

End Sub

When the OK command button is selected, the value for the display frequency is validated.

Private Sub cmdOK_Click()

Dim sInputNo As String

sInputNo = txtDisplayFreq.Text

'***** Check for selection that is out of range

If (Val(sInputNo) < 0) Then

txtDisplayFreq.Text = 0

Exit Sub

End If

If (Val(sInputNo) > 9) Then

txtDisplayFreq.Text = 9

Exit Sub

End If

'***** If the input was ok, exit

'***** Set display freq global variable

g_DisplayFreq = (Val(txtDisplayFreq.Text))

'***** If display freq is 0, deactivate display

If g_DisplayFreq <> 1 Then

frmMain!Kscan1.Display = False

Else

frmMain!Kscan1.Display = True

End If

 

'***** Hide Display Freq Form

Me.Hide

End Sub

Three new global variables are added to the General Declarations of the KFUTIL.BAS file: g_DisplayFreq, g_PEFileName and g_Pefront. These global variables are used to determine the frequency in which images should be displayed, the filename to which the image was saved, and the page to which the image was saved.

'***** Global variables for display frequency

Global g_DisplayFreq As Integer 'Display Frequency

Global g_PEFileName As String 'KScan.PEFileName

Global g_PEfront As Boolean 'Front or Back Image

When the main form is loaded, Form_Load event, the global variable g_DisplayFreq is initialized. It is initialized to a value of one (1), or to display all images while processing.

'***** Initialize Display Frequency.

g_DisplayFreq = 1

It is determined if the image is a front or back side image during the KScan_PageEnd event.

(Existing Code)

'***** Increment page count (unless back of duplex)

If Kscan1.PEFront Then

g_PEPageCount = g_PEPageCount + 1

g_TotalPages = g_TotalPages + 1

(New Code)

'***** Set flag for front or back image

g_PEfront = True

Else

g_PEfront = False

(Existing Code)

End If

Kscan1.IOWriteMode = g_PEWriteMode

The filename and page to view are also updated during the KScan_PageEnd event.

(Existing Code)

Select Case g_PEWriteMode

Case KGIOWRITEMODEINSERT:

KFPageEndNameBuild

.

.

.

Case KGIOWRITEMODEAPPEND:

KFPageEndNameBuild

(New Code)

'***** The KScan.Page property is not used when appending.

'***** This updates the existing g_PEPage variable for

'***** use with Display Frequency.

g_PEPage = Kscan1.PEPageCount + 1

(Existing Code)

.

.

.

End Select

'***** Set filename to nothing so it is not saved

'***** (if it is smaller than the delete threshold)

If Kscan1.PEDelete Then

g_PEFileName = ""

End If

Kscan1.PEPage = g_PEPage

(New Code)

'***** Update KScan.PEFileName for Display Freq.

g_PEFileName = Kscan1.PEFileName

Finally, during the KScan_PageDone event the filename, page and whether it is a front or back page are set and the image is viewed. If the user has selected zero (0) or one (1) for the display frequency, then the standard way of handling the viewing of scanned image is performed. If not, then the images are manually displayed. This is placed at the end of the procedure.

'***** Determine filename, page, front or back image

'***** and determine if it should be viewed.

If g_DisplayFreq < 2 Then Exit Sub

If (g_PEPageCount Mod g_DisplayFreq) = 0 Then

If g_PEfront Then

KViewLeft.FileName = g_PEFileName

KViewLeft.Action = KVACTIONOPENIMAGE

KViewLeft.Page = g_PEPage

KViewLeft.Refresh

Else

KViewRight.FileName = g_PEFileName

KViewRight.Action = KVACTIONOPENIMAGE

KViewRight.Page = g_PEPage

KViewRight.Refresh

End If

End If

Back To Top

Kofax ImageControls Support

The Kofax ImageControls support group is skilled in Visual Basic and Visual C++ development and can assist developers in building their custom imaging applications. Our engineers can also point developers to source code samples on the Kofax FTP site.

The ImageControls 3 Technical Support Web pages have been kept up to date. We encourage ImageControls developers to investigate the information in these Web pages before looking for other sources of support. Use the menu options in the upper left side of this page to access additional product support Web pages for this product.


For details regarding technical support available for all Kofax products, please review the current Support Overview & Options and Product Support Eligibility Matrix Web pages.