User manual

Table Of Contents
FieldMaxII-TO User Manual
46
4. Pass the callback object to the cFM2Listener
object.
5. Start the cFM2ScanUSBForChange object status
change engine.
The following Visual Basic 6.0 code shows the steps:
‘Global declarations:
‘This is the private instance of the cFM2Listener class
Dim FieldMax2Listener As cFM2Listener
‘This points to the cFM2Listener object's IFM2Listener interface
Dim ThisListener As IFM2Listener
‘Timer objects
Dim ScanUSBForChange As cFM2ScanUSBForChange
Dim ScanForData As cFM2ScanForData
‘Callback sink (receives event notifications)
Dim NotifyMe As cFM2Notify
‘Executable code:
‘Create a cFM2Listener object and obtain an IFM2Listener interface
‘to it
Set FieldMax2Listener = New cFM2Listener
Set ThisListener = FieldMax2Listener
‘Create the cFM2ScanUSBForChange and cFM2ScanForData objects
Set ScanUSBForChange = New cFM2ScanUSBForChange
Set ScanForData = New cFM2ScanForData
‘Create the cFM2Notify callback object
Set NotifyMe = New cFM2Notify
‘Pass the callback object to the cFM2Listener object
FieldMax2Listener.DeviceEvents = NotifyMe
‘Start the cFM2ScanUSBForChange object status change engine
ScanUSBForChange.CheckTimer ThisListener