ClearCleck21 MICR Reader
FindMICR Method
CcMicrReader Object : FindMICR Method
Description
Read one or more MICR lines on the bottom portion of an image. 
Syntax
Visual Basic
Public Function FindMICR() As Integer
Return Type
Number of MICR lines found.
Remarks
Locates MICR line on the bottom of the document.   If MICR line is located elsewhere use ExtractCheck to obtain check image and MICR line.
Example
In VB project Add Reference to ClearCheck21 MICR Reader
Private Function ReadOneMicr(file As String, page As Integer) As String
  Dim out As String
  Dim reader As New CcMicrReader
  reader.Image.Open file, 1
  reader.FindMICR
  If (reader.MicrCount > 0) Then
    Dim micr As CcMicr: Set micr = reader.MicrLine(1)
    out = out + "MICR Type: " + micr.DocumentType + vbCrLf
    If (micr.Routing.IsRead) Then out = out + "Routing = " & micr.Routing.TextANSI + vbCrLf
    If (micr.AuxOnUs.IsRead) Then out = out + "AuxOnUs = " & micr.AuxOnUs.TextANSI + vbCrLf
    If (micr.OnUs.IsRead) Then out = out + "OnUs = " & micr.OnUs.TextANSI + vbCrLf
    If (micr.Amount.IsRead) Then out = out + "Amount = " & micr.Amount.TextANSI + vbCrLf
    If (micr.Account.IsRead) Then out = out + "Account = " & micr.Account.TextANSI + vbCrLf
    If (micr.CheckNumber.IsRead) Then out = out + "CheckNumber = " & micr.CheckNumber.TextANSI + vbCrLf
  Else
      out = "No MICR found"
  End If
  ReadOneMicr = out
End Function
In C# project Add Reference -> COM Tab -> ClearCheck21 MICR Reader
static System.Threading.Mutex mut =  new System.Threading.Mutex();    // Prevents reentrancy

public static string ReadOneMICR (string file, int page)
{
    try 
    { 
    string sout = "";
    mut.WaitOne();      // Prevent reentrancy
    ClearMicr.CcMicrReader reader = new ClearMicr.CcMicrReader();
    reader.Image.Open(file, page); 
            // Do actual reading 
    reader.FindMICR();
            // Display results
    if (reader.MicrCount > 0)
       {
         ClearMicr.CcMicr Micr = reader.get_MicrLine(1);
        sout = sout + "MICR Type: " + Micr.DocumentType + Environment.NewLine;
        if (Micr.Routing.IsRead) 
            sout = sout + "Routing = " + Micr.Routing.TextANSI + Environment.NewLine;
        if (Micr.AuxOnUs.IsRead) 
            sout = sout + "AuxOnUs = " + Micr.AuxOnUs.TextANSI + Environment.NewLine;
        if (Micr.OnUs.IsRead) 
            sout = sout + "OnUs = " + Micr.OnUs.TextANSI + Environment.NewLine;
        if (Micr.Amount.IsRead) 
            sout = sout + "Amount = " + Micr.Amount.TextANSI + Environment.NewLine;
        if (Micr.Account.IsRead)
            sout = sout + "Account = " + Micr.Account.TextANSI + Environment.NewLine;
        if (Micr.CheckNumber.IsRead) 
          sout = sout + "CheckNumber = " + Micr.CheckNumber.TextANSI + Environment.NewLine;
        }
    else
      sout = "No MICR found";
        return  sout; 
    } 
    catch (Exception ex) 
    { 
        return ("ERROR: " + ex.ToString()); 
    } 
    finally
    {
        mut.ReleaseMutex();
        System.GC.Collect();
    }
}
In Delphi project Import Type Library for ClearCheck21 MICR Reader. Click Create Unit
uses ClearMicr_TLB;
 
var
  reader: TccMicrReader;
 
procedure TfmMain.FormCreate(Sender: TObject);
Begin
  inherited;
  reader :=  TccMicrReader.Create(self);
end;
 
procedure TfmMain.FormDestroy(Sender: TObject);
Begin
  inherited;
  reader.Free;
end;
 
 procedure FindMicr(Const FileName: String, 
    var Route,Checksum,OnUs,AuxOnUs,EPC,Amount,Account: String);
  var
    Cnt: Integer;
    Micr: ccMicr;
  Begin
    Route := '';
    CheckSum := '';
    OnUs := '';
    AuxOnUs := '';
    EPC := '';
    Amount := '';
    Account := '';
    reader.Image.Open(FileName,1);
    Cnt := reader.FindMICR;
    If Cnt > 0 Then
      Begin
        Micr := reader.MicrLine[1];
        If Micr.Routing.IsRead Then
          Route := Micr.Routing.TextANSI;
        If Micr.RoutingChecksum.IsRead Then
          CheckSum := Micr.RoutingChecksum.TextANSI;
        If Micr.OnUs.IsRead Then
          OnUs := Micr.OnUs.TextANSI;
        If Micr.AuxOnUs.IsRead Then
          AuxOnUs := Micr.AuxOnUs.TextANSI;
        If Micr.EPC.IsRead Then
          EPC := Micr.EPC.TextANSI;
        If Micr.Amount.IsRead Then
          Amount := Micr.Amount.TextANSI;
        If Micr.Account.IsRead Then
          Account := Micr.Account.TextANSI;
      end;
  End;
###############   In header file
#include <atlbase.h>
extern CComModule _Module; 
#import  "progid:ClearImage.ClearImage" no_namespace  named_guids
#import "msvbvm60.dll" rename("RGB","VBRGB") rename("EOF","VBEOF") rename("GetObject","VBGetObject")
using namespace VBA;
#import  "progid:ClearMicr.CcMicrReader" no_namespace  named_guids

###############  In source file
bool ReadOneMicr  (char *fileName)
    {
    try 
        {
        _CcMicrReaderPtr Reader;
        HRESULT hr = Reader.CreateInstance(__uuidof(CcMicrReader));
        Reader->Image->Open(_bstr_t(fileName), 1);
        int cnt = Reader->FindMICR();
        if (cnt > 0)
          {
             _CcMicrPtr micr = Reader->MicrLine[1];
           printf ("MICR Document Type %s\n", (LPCTSTR)(micr->DocumentType));
           printf ("MICR: %s\n",  (LPCTSTR) (micr->Info->TextRaw));
           if (micr->AuxOnUs->IsRead)
                 printf ("AuxOnUs: %s\n",  (LPCTSTR) (micr->AuxOnUs->TextANSI));
           if (micr->EPC->IsRead)
                 printf ("EPC: %s\n",  (LPCTSTR) (micr->EPC->TextANSI));
           if (micr->Routing->IsRead)
                 printf ("Routing: %s\n",  (LPCTSTR) (micr->Routing->TextANSI));
           if (micr->RoutingChecksum->IsRead)
                 printf ("RoutingChecksum: %s\n",  (LPCTSTR) (micr->RoutingChecksum->TextANSI));
           if (micr->OnUs->IsRead)
                 printf ("OnUs: %s\n",  (LPCTSTR) (micr->OnUs->TextANSI));
           if (micr->Amount->IsRead)
                 printf ("Amount: %s\n",  (LPCTSTR) (micr->Amount->TextANSI));
           if (micr->Account->IsRead)
                 printf ("Account: %s\n",  (LPCTSTR) (micr->Account->TextANSI));
           if (micr->CheckNumber->IsRead)
                 printf ("CheckNumber: %s\n",  (LPCTSTR) (micr->CheckNumber->TextANSI));
            }
            return true;
        }
    catch (_com_error &ex)
        {
        printf ("Error: Code: 08lx  Descriptions" , 
                        ex.Error(), (LPCSTR)ex.Description()); 
        return false;
        }
    }
See Also

CcMicrReader Object  | CcMicrReader Members