<< Prev        Next >>

ID : 5769

RemoveHandler

Function

Stop receiving events from providers.

This command is available in Ver.1.7.* or higher.

Syntax

RemoveHandler object

Guaranteed entry

object
Specify an object registered by AddHandler.

Description

Stop receiving events from providers.

Attention

-

 

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 : 5769

<< Prev        Next >>