InetSendLoadRsp Example for Visual Basic
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 nRet As Integer
Dim nStatus As Integer
Dim szOut$
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_LOAD
'
check the validity of the parameters
If
((Params.ParamCount = 4) And (Params.ParamType(0) = PARAM_TYPE_STRING)
And (Params.ParamType(1) = PARAM_TYPE_INT32) And (Params.ParamType(2)
= PARAM_TYPE_INT32) And (Params.ParamType(3) = PARAM_TYPE_UINT32)) Then
'Note,
this is a function you must create
nStatus
= ProcessLoadCommand(Params.ParamValue(0).StringValue)
Debug.Print
"Received LoadBitmapCmd - Loaded Bitmap " & Params.ParamValue(0).StringValue
LEADNet1.InetSendLoadRsp
nCommandID, gnBitmapID, 0, Null, nStatus
Exit
Sub
End
If
Case INETCMD_CREATE_WIN
'
check the validity of the parameters
If
((Params.ParamCount = 8) And (Params.ParamType(0) = PARAM_TYPE_STRING)
And (Params.ParamType(1) = PARAM_TYPE_STRING) _
And (Params.ParamType(2) = PARAM_TYPE_UINT32) And (Params.ParamType(3)
= PARAM_TYPE_INT32) And (Params.ParamType(4) = PARAM_TYPE_INT32) _
And (Params.ParamType(5) = PARAM_TYPE_INT32) And (Params.ParamType(6) =
PARAM_TYPE_INT32) And (Params.ParamType(7) = PARAM_TYPE_UINT32)) Then
'Note,
this is a function you must create
nRet
= ProcessCreateWinCommand(Params.ParamValue(1).StringValue, _
Params.ParamValue(3).LongValue, _
Params.ParamValue(4).LongValue, _
Params.ParamValue(5).LongValue, _
Params.ParamValue(6).LongValue, True)
nRet
= LEADNet1.InetSendCreateWinRsp(nCommandID, nRet, 0, Null, 0)
Exit
Sub
End
If
Case INETCMD_ATTACH_BITMAP:
If
((Params.ParamCount = 2) And (Params.ParamType(0) = PARAM_TYPE_UINT32)
And (Params.ParamType(1) = PARAM_TYPE_UINT32)) Then
'Note,
this is a function you must create
nStatus
= ProcessAttachBitmapCommand(Params.ParamValue(0).DoubleValue)
Else
nStatus
= ERROR_INV_PARAMETER
End
If
LEADNet1.InetSendAttachBitmapRsp
nCommandID, 0, Null, nStatus
Exit
Sub
Case INETCMD_SAVE
If
((Params.ParamCount = 6) And (Params.ParamType(0) = PARAM_TYPE_STRING)
And (Params.ParamType(1) = PARAM_TYPE_UINT32) _
And (Params.ParamType(2) = PARAM_TYPE_INT32) And (Params.ParamType(3) =
PARAM_TYPE_INT32) _
And (Params.ParamType(4) = PARAM_TYPE_INT32) And (Params.ParamType(5) =
PARAM_TYPE_UINT32)) Then
'Note,
this is a function you must create
nStatus
= ProcessSaveCommand(Params.ParamValue(0).StringValue, Params.ParamValue(2).LongValue,
Params.ParamValue(3).LongValue, Params.ParamValue(4).LongValue)
LEADNet1.InetSendSaveRsp nCommandID,
0, Null, nStatus
Exit
Sub
Else
nStatus
= ERROR_INV_PARAMETER
End
If
End Select
End If
'return an error response
LEADNet1.InetSendRspInetCommand,
nCommandID, Nothing, 0, Null, nStatus
End Sub