hi forum, after much searching, I found an example for the management of the api in vb6 posted by Royce3, after some minor alterations to make to achieve it to work well, AUI I leave so they can experience and that You will not find any echo in vb6 to handle the api. I hope this will be useful, and discuss their progress, I keep working !!!..
The script is working fine for me, the API is enabled and I can log in the router.
When I click SEND, I can see the same results. The probleme is when I click again on SEND, I get the OLD result + the new one. I cleared the text field before clicking SEND (txtout.text=“”), but same problem. It seem the buffer is not clearing after the command is executed. I suspect the inbuf1 variable.
@ax045Y
Do not use Package and Deployment Wizard to compile project, use VB6 IDE ‘File/Make…’ command instead.
In this case compiler shows you what and where is wrong with code.
This API example works fine, problem is with ‘CRAM_MD5’ function in ‘MD5.cls’.
Remove this function and you will be able to compile this example to .EXE.
Doris, i have your problem also, and after a hours i got this
change this
Private Sub ws_DataArrival(ByVal sent$)
.
.
.
end sub
into this
Private Sub ws_DataArrival(ByVal bytesTotal As Long)
If bErr Then Exit Sub
Dim ar() As Byte, i&
ReDim ar(0 To bytesTotal - 1)
ws.GetData ar, vbByte, bytesTotal
On Error Resume Next
Err.Clear
On Error GoTo 0
inbuf1 = ar
Dim WordLen&, StartIdx&, Idx&
StartIdx = 0
Do While True
Idx = StartIdx
WordLen = CalcWordLen(inbuf1, Idx)
If WordLen < 0 Then
Exit Do
End If
If WordLen = 0 Then
SentenceArrived (inbuf2)
inbuf2 = ""
Else
If inbuf1(Idx) = Asc("=") Then
inbuf2 = inbuf2 & " "
End If
For i = 0 To WordLen - 1
inbuf2 = inbuf2 & Chr(inbuf1(Idx + i))
Next
End If
StartIdx = Idx + WordLen
Loop
End Sub
that solve my problem,
and for good looking change this :
Private Sub SendCommand(ByVal sCmd$)
.
.
.
End Sub
into this
Private Sub SendCommand(ByVal sCmd$)
Dim ar$(), i&, buf() As Byte
Out Replace(sCmd, " ", vbCrLf )
ar = Split(sCmd, " ")
For i = 0 To UBound(ar)
EncodeWord buf, ar(i)
Next
EncodeWord buf, ""
If ws.State = sckConnected Then ws.SendData buf
End Sub
im working vb api to create and generate hotspot user, because with user manager maximal active session for lvl4 is 20, its better to use /ip/hotspot than /tool/user-manager, hotspot active user can up to 200,
wait for my next reply with full VB code for create user, im sory for my bad english, this is my firts post