MagTek MTMICRImage User Manual

Page 28

Advertising
background image

MTMicrImage.OCX

24

Private Sub Form_Load()
txtCommPort.Text = MICRImage.GetDefSetting("CommPort", "1")
txtSettings.Text = MICRImage.GetDefSetting("Settings", "115200,N,8,1")
lblCaption(0).Caption = App.ProductName
lblCaption(1).Caption = App.ProductName
End Sub

Private Sub MicrImage1_MicrDataReceived()
Dim ImagePath As String
Dim ImageFileName As String
Dim ImageIndex As String
Dim Status As Long
Dim StatusMsg As String
Dim bOpStatus As Boolean

If MICRImage.GetTrack(1) & MICRImage.GetTrack(2) & MICRImage.GetTrack(3) <> ""
Then
LogStatus "Event Fired: MagStripe Data"
txtMagStripeData.Text = MICRImage.MicrData
txtFirstName.Text = MICRImage.GetFName()
txtLastName.Text = MICRImage.GetLName()
txtMonth.Text = MICRImage.FindElement(2, "=", 2, "2", False)
txtYear.Text = MICRImage.FindElement(2, "=", 0, "2", False)
txtTrack1.Text = MICRImage.GetTrack(1)
txtTrack2.Text = MICRImage.GetTrack(2)
txtTrack3.Text = MICRImage.GetTrack(3)
txtAccountNum.Text = MICRImage.FindElement(2, ";", 0, "=", False)
Else
LogStatus "Event Fired: MicrData"
txtMicrData.Text = MICRImage.MicrData
txtMicrAccountNum.Text = MICRImage.FindElement(0, "TT", 0, "A", False)
txtCheckNum.Text = MICRImage.FindElement(0, "A", 0, "12", False)
txtTransit.Text = MICRImage.FindElement(0, "T", 0, "TT", False)

ImagePath = MICRImage.GetDefSetting("ImagePath", "C:\")

'This sets up an index number so that we can deal with same check being
'inserted over and over. The TransmitCurrentImage Method with fail if the file
'already exists. This is to ensure that no check image is overwritten. By keeping
'an ImageIndex and incrementing it we ensure that the same file name will not be
'generated below. You are free to name the file anything that is considered to be
'a valid file name.
ImageIndex = MICRImage.GetDefSetting("ImageIndex", "0")

ImageIndex = CStr(CInt(ImageIndex) + 1)
MICRImage.SaveDefSetting "ImageIndex", ImageIndex

ImageFileName = ImagePath & "MI" & txtTransit.Text & txtMicrAccountNum.Text &
txtCheckNum.Text & ImageIndex & ".TIF"

Advertising