ID : 3908
RemoveHandler
Function
Stop receiving events from providers.
Description
Stop receiving events from providers.
Attention
-
Related Terms
Example
Sample code shows how to receive a reading data with the QR code provider when the QR code reader reads QR code.
Dim g_Counter As Integer = 0 'Number of data to receive
Sub Main()
Dim ctrl As Object
ctrl = Cao.AddController( "QR", "CaoProv.DENSO.QRCode", "",
"Conn=com:6:38400:N:8:1, Mode=5, Protocol=0:0:0" )
'Specify the event name and area to receive
AddHandler ctrl, "OnMessage", OnMessage
g_Counter = 0
'Loop command to keep waiting event receiving
Do
Delay 10
If g_Counter >= 3 Then Exit Do
Loop
'Stop event receiving
RemoveHandler ctrl
End Sub
'Event Handler for OnMessage
Sub OnMessage( ByVal Sender As Object, ByVal Args As Variant )
Dim msg as object
msg = Args(0) '::= CaoMessage object
PrintDbg "" & Time & " - CODE = [" & msg.Value & "]"
g_Counter = g_Counter + 1
End Sub
ID : 3908