While the program is trying to connect, no messages will reach the window telling it to redraw, so if anything changes you won't see until the for...next loop is broken. Try using a thread to get around this:
Code: Select all
Result = InitNetwork()
If Result = 0
MessageRequester("Error","No Connection Found",0)
EndIf
Enumeration
#Window_0
EndEnumeration
Ip$ = "127.0.0.1"
Enumeration
#Listview_0
EndEnumeration
Procedure Network()
For A=135 To 65536
B = OpenNetworkConnection(Ip$,A)
If B
AddGadgetItem (#Listview_0,-1,"Item "+Str(A)+" of the Listview")
EndIf
Next
EndProcedure
OpenWindow(#Window_0, 329, 114, 219, 178, #PB_Window_SystemMenu | #PB_Window_TitleBar , "Scanner")
CreateGadgetList(WindowID())
ListViewGadget(#Listview_0, 5, 5, 210, 170)
NetworkThread = CreateThread(@Network(),0)
Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
you could also do something like this, although I don't quite like it as much (I think that network systems should never share threads with the rest of a program)
Code: Select all
A = 135
Repeat
event = WindowEvent()
If event
Select event
Case #PB_Event_CloseWindow
End
EndSelect
Else
If A < 65536
B = OpenNetworkConnection(Ip$,A)
If B
AddGadgetItem (#Listview_0,-1,"Port "+Str(A)+" open")
EndIf
A = A + 1
endif
EndIf
forever