InetReceiveCmd Example for Visual Basic
' my user defined commands
Private Const INETCMD_FLIP = INETCMD_USER_CUSTOM
Private Function ProcessFlipCommand(ByVal nID&) As Integer
MsgBox "Flip"
ProcessFlipCommand = 0
End Function
Private Sub LEADNet1_InetReceiveCmd(ByVal
iComputer As Integer, ByVal InetCommand As Integer, ByVal nCommandID As
Long, ByVal nError As Integer, ByVal Params As LEADRasterInetLib.ILEADRasterInetPacket,
ByVal nExtraDataSize As Long, ByVal ExtraData As LEADRasterVariant)
Dim szOut$
Dim nRet As Integer
Dim nStatus As Integer
Dim i As Integer
Dim pszData As String
nStatus = ERROR_FEATURE_NOT_SUPPORTED
szOut$ = "Command " & CStr(InetCommand)
& " id=" & CStr(nCommandID) & ", nError="
& CStr(nError) & " nParams=" & CStr(Params.ParamCount)
& " received"
If (nExtraDataSize > 0) Then
szOut$ = szOut$ & ", nExtraDataSize="
& CStr(nExtraDataSize)
End If
Debug.Print (szOut$)
If (nExtraDataSize > 0) Then
' convert to a string
For i = 0 To nExtraDataSize - 1
pszData = pszData
+ Chr(ExtraData(i))
Next
Debug.Print "ExtraData: "
& pszData
End If
If (nError <> 0) Then
nStatus = ERROR_TRANSFER_ABORTED
Else
Select Case InetCommand
Case INETCMD_FLIP:
If
((Params.ParamCount = 1) And (Params.ParamType(0) = PARAM_TYPE_UINT32))
Then
'Note:
This is a function you have to create
nStatus
= ProcessFlipCommand(Params.ParamValue(0).DoubleValue)
Else
nStatus
= ERROR_INV_PARAMETER
End
If
End Select
End If
'return an error response
LEADNet1.InetSendRsp
InetCommand, nCommandID, Nothing, 0, Null, nStatus
End Sub