It is currently Mon Jan 25, 2021 8:39 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: window locks
PostPosted: Mon Apr 05, 2004 8:25 pm 
Offline
User
User

Joined: Sat Jan 03, 2004 6:50 pm
Posts: 31
Code:
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

OpenWindow(#Window_0, 329, 114, 219, 178,  #PB_Window_SystemMenu | #PB_Window_TitleBar , "Scanner")
CreateGadgetList(WindowID())
ListViewGadget(#Listview_0, 5, 5, 210, 170)
For A=135 To 65536
B = OpenNetworkConnection(Ip$,A)
If B
AddGadgetItem (#Listview_0,-1,"Item "+Str(A)+" of the Listview")
EndIf
Next
Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow


anybody help me?
the listview won't show, unless im disconnected

_________________
1300 @ 1450mhz, DDR400, MX440, XP pro / 2000Pro


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Apr 05, 2004 8:32 pm 
Offline
User
User

Joined: Sun Feb 15, 2004 8:04 pm
Posts: 92
Location: Manchester, UK
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:

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


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Apr 05, 2004 8:56 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Fri Apr 25, 2003 4:34 pm
Posts: 1032
Location: Canada
Most people just force a refresh after adding an item...

AddGadgetItem (#Listview_0,-1,"Item "+Str(A)+" of the Listview")
While WindowEvent():Wend

_________________
Image Image


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Apr 06, 2004 6:36 am 
Offline
User
User

Joined: Sat Jan 03, 2004 6:50 pm
Posts: 31
thanks for the help people
:> :) :>

_________________
1300 @ 1450mhz, DDR400, MX440, XP pro / 2000Pro


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: Seymour Clufley and 53 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye