my concept:
one script per machine.
has a list of every IP that has that script, and which LAN its connecting to on your machine. here are some images of a concept design i showed to a buddy last semester (i appologize if anything is hard to read, or see.).
[attachment=32354:OMNI.JPG]
[attachment=32355:OMNI2.JPG]
Please, if my knowledge of TCP\IP\UDP is wrong correct me. i want to make it right. And if you find any Bugs let me know! But most of all,
EDIT: you will need some UDFs that aren't standard. Thanks To MELBA23 for his help on this part!!
DIRECT LINK
Scrollbars Made Easy TOPIC
Opt ('GUIONEVENTMODE',1) #include <WINAPI.au3> #Include <GuiMenu.au3> #include <WindowsConstants.au3> #Include <GuiTreeView.au3> #Include <GuiEdit.au3> #include <misc.au3> #include <array.au3> #include <EditConstants.au3> #include <StaticConstants.au3> #Include <GuiScrollBars.au3> #include <ScrollBarConstants.au3> #include "GUIScrollbars_Size.au3" #include "GUIScrollbars_EX.au3" _Singleton (@ScriptName) ;This VAR is a REGKEY with elements that contain all connected and enabled NICs, functional and nonfunctional. Global $NetworkCards = 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\' ;----------------------------------------------------------------------------------------------------------- Global $WIDTH = @DesktopWidth/2 Global $HEIGHT = @DesktopHeight/2 Global $buttonheight = 25 Dim $id_TreeView Dim $hWnd_TreeView Dim $UDP Global $hMain = CreateMainGUI (@ScriptName,$WIDTH,$HEIGHT) Global $NIC_Count = GetNICCount () If $NIC_Count >= 1 Then Dim $GUID_KEY_ARRAY[$NIC_Count+1] ;1-based array, Containing each NIC's unique ID. $GUID_KEY_ARRAY[0] = $NIC_Count Dim $GUID_TreeView_ID[$NIC_Count+1][3] ;1-based array, Containing Each NIC Treeview Item and its 2 children. $GUID_TreeView_ID[0][0] = $hWnd_TreeView Dim $NIC_IP_LIST[$NIC_Count+1];1-based array, Containing Each NIC's IP List in string format. $NIC_IP_LIST[0] = $NIC_Count Dim $Network_Adapter_Info_Array[$NIC_Count+1][6] ;1-based array, Some Information That is Needed Taken From The RegKey for That NIC. $Network_Adapter_Info_Array[0][0] = $NIC_Count For $n = 1 To $NIC_Count $GUID_KEY_ARRAY[$n] = 0 $GUID_TreeView_ID[$n][0] = 0 $NIC_IP_LIST[$n] = 0 For $u = 1 To $NIC_Count $Network_Adapter_Info_Array[$n][$u] = 0 Next Next Global $UDP = UDPStartup () If @error <> 0 Then Exit For $n = 1 To $NIC_Count Startup_Every_NIC ($n) Next Else MsgBox (48,'ERROR','No Networking Interface Cards Are Present.',Default,WinGetHandle ('[active]')) _Exit () EndIf GUIRegisterMsg($WM_VSCROLL, "_Scrollbars_WM_VSCROLL") AdlibRegister ('BroadCastToALL',1000) AdlibRegister ('ReceiveData') Do Sleep (100) Until Not WinExists ($hMain) _Exit () Func CreateMainGUI ($title,$w,$h) Local $hwnd,$cw, $ch,$th, $x,$y, $bw,$CtrlID $hwnd = GUICreate ($title,$w,$h) SetWindowColors ($hwnd) GUISetOnEvent (-3,'CloseWindow',$hwnd) GUISetState (@SW_SHOW,$hwnd) $x = 0 $y = $buttonheight*2 $cw = _WinAPI_GetClientWidth ($hwnd) $ch = _WinAPI_GetClientHeight ($hwnd) $th = $ch-($buttonheight*2) $CtrlID = GUICtrlCreateLabel ('Select An IP under IP Listings, and choose one of these options below.',0,0,$cw,$buttonheight) $bw = $cw/5 $CtrlID = GUICtrlCreateButton ('Chat',0,$buttonheight,$bw,$buttonheight) GUICtrlSetOnEvent ($CtrlID,'ClickedChat') $CtrlID = GUICtrlCreateButton ('unknown',$bw,$buttonheight,$bw,$buttonheight) $CtrlID = GUICtrlCreateButton ('unknown',$bw*2,$buttonheight,$bw,$buttonheight) $CtrlID = GUICtrlCreateButton ('unknown',$bw*3,$buttonheight,$bw,$buttonheight) $CtrlID = GUICtrlCreateButton ('unknown',$bw*4,$buttonheight,$bw,$buttonheight) Global $id_TreeView = GUICtrlCreateTreeView ($x,$y,$cw,$th) Global $hWnd_TreeView = GUICtrlGetHandle ($id_TreeView) _GUICtrlTreeView_SetIcon($hWnd_TreeView, Default,@SystemDir & '\Shell32.dll',12) ;Sets the Default ICON to the hardware CHIP. Return $hwnd EndFunc Func GetNICCount () Local $n = 0 While 1 $n += 1 If RegEnumKey ($NetworkCards,$n) = '' Then Return $n - 1 WEnd EndFunc Func ReceiveData () Local $n, $data For $n = 1 To $NIC_Count ;making a loop for EACH NIC. If $Network_Adapter_Info_Array[$n][4] = -1 Then ;This is the socket that is created as a listening socket on the local IP for Each NIC. ContinueLoop Else $data = UDPRecv ($Network_Adapter_Info_Array[$n][4],1024) If @error Then If -1 >= @error >= -3 Then $data = $GUID_KEY_ARRAY[$n] & @CRLF & '[recv]Invalid SOCKETARRAY' MsgBox (48,'ERROR','ERROR-CODE=' & @error & @CRLF & $data,10,WinGetHandle ('[active]')) Else Select Case StringLeft ($data,StringLen ('[online]=')) == '[online]=' RCVOnline ($n,StringTrimLeft ($data,StringLen ('[online]='))) Case StringLeft ($data,StringLen ('[offline]=')) == '[offline]=' RCVOffline ($n,StringTrimLeft ($data,StringLen ('[offline]='))) Case StringLeft ($data,StringLen ('[msg]=')) == '[msg]=' RCVNewMessage ($n,$data) Case Else ContinueLoop EndSelect EndIf EndIf Next EndFunc Func RCVOnline ($Instance,$IP) Local $hwnd If $IP <> $Network_Adapter_Info_Array[$Instance][1] Then ;IF the connecting IP isn't the same as the Current NIC's IP (YOUR LOCAL IP). If StringInStr ($NIC_IP_LIST[$Instance],'[' & $IP & ']') = 0 Then ;Checks if a duplicate IP is there. $NIC_IP_LIST[$Instance] &= '[' & $IP & ']';Adds it too the list for the specific IP. $hwnd = _GUICtrlTreeView_AddChild($hWnd_TreeView,$GUID_TreeView_ID[$Instance][2],$IP) ;Creates A Treeview Item under the NIC's IP Listing. _GUICtrlTreeView_SetIcon($hWnd_TreeView,$hwnd,@SystemDir & '\Shell32.dll',15) EndIf EndIf EndFunc Func RCVOffline ($Instance,$IP) _Exit () ;default, i'm not sure what i'm going to do here. ;~ If $data <> $Network_Adapter_Info_Array[$n][1] Then ;~ If StringInStr ($NIC_IP_LIST[$n],'[' & $data & ']') Then ;~ $NIC_IP_LIST[$n] = StringReplace ($NIC_IP_LIST[$n],'[' & $data & ']','') ;~ ;======================== ;~ ;NEED TO FIND OUT HOW TO DELETE THE TREEV IITEM ;~ ;======================== ;~ EndIf ;~ EndIf EndFunc Func RCVNewMessage ($Instance,$Data) Local $array, $TO,$msg,$FROM, $string, $stringlen $stringlen = StringLen ('[msg]=') $string = StringTrimLeft ($data,$stringlen) $array = StringSplit ($string,Chr (31)) ;An Array is supposed to look like this ;---------------------------------------------- ;[msg]=TOIP & CHR(31) & msg & CHR(31) & FROMIP ;---------------------------------------------- If IsArray ($array) Then If UBound ($array) = 4 Then $TO = $array[1] $msg = $array[2] $FROM = $array[3] If $Network_Adapter_Info_Array[$Instance][1] = $TO Then Addmessage ($FROM,$Msg,$FROM) ;If THEY send it to THEIR chat window on YOUR Computer. EndIf EndIf EndFunc Func GetCtrlCount($hwnd,$Class) Local $count = 0 While 1 $count += 1 If ControlGetHandle($hwnd, '', $Class & $count) = '' Then Return $count - 1 WEnd EndFunc Func GetLastMessageIP ($hwnd) Local $string, $strinstr ;Message Posts Are Supposed To Look Like This ;---------------------------------------------- ;IP Says: ;>>>> ...... ;---------------------------------------------- ;This Gets the Character Position of the space between the IP and SAYS: returns IP $string = ControlGetText ($hwnd,'','Edit' & GetCtrlCount ($hwnd,'Edit')) $strinstr = StringInStr ($string,' ') If $strinstr > 0 Then Return StringMid ($string,1,$strinstr-1) EndFunc Func Addmessage ($TO,$msg,$FROM) Local $hwnd,$x,$y,$w,$h,$aRet, $CtrlID, $n, $cw, $ch If Not WinExists ($TO) Then CreateNewWindow ($TO) $msg = @CRLF & '>>>' & @TAB & $msg & @CRLF $hwnd = WinGetHandle ($TO&'SCROLL') $cw = _WinAPI_GetClientWidth($hwnd) $ch = _WinAPI_GetClientHeight($hwnd) $x = $buttonheight $y = $buttonheight + GetCtrlCount ($hwnd,'Edit') * ($buttonheight*4) ;Gets How Many Edit's there are, and multiplies it by a height for a total. $w = $cw-($x*2) $h = $buttonheight*3 GUISwitch ($hwnd) If GetCtrlCount ($hwnd,'Edit') >= 1 Then If GetLastMessageIP ($hwnd) == $FROM Then ;To Continue The Last Post With The Last Poster. $ehwnd = ControlGetHandle ($hwnd,'','Edit' & GetCtrlCount ($hwnd,'Edit')) Else _GUIScrollBars_SetScrollInfoPos($hwnd, $SB_VERT, 0) ;Scrolls To Begining $CtrlID = GUICtrlCreateEdit ('',$x,$y,$w,$h,BitOR ($ES_READONLY,$WS_TABSTOP,$WS_VSCROLL)) $ehwnd = GUICtrlGetHandle ($CtrlID) $msg = $FROM & ' Says:' & $msg If $TO == $FROM Then GUICtrlSetBkColor ($CtrlID,0xFEDCBA) ;Sets New Size Of Window and Scrolls To New position. ;------------------------------------------- If $y+$h > _WinAPI_GetClientHeight($hwnd) Then $aRet = _GUIScrollbars_Size(0, $y+$h,$cw,$ch) _GUIScrollBars_SetScrollInfoPage($hwnd, $SB_VERT, $aRet[2]) _GUIScrollBars_SetScrollInfoMax($hwnd, $SB_VERT, $aRet[3]) _GUIScrollBars_SetScrollInfoPos($hWnd, $SB_VERT,_GUIScrollBars_GetScrollInfoMax ($hwnd,$SB_VERT)) EndIf ;------------------------------------------- EndIf Else $CtrlID = GUICtrlCreateEdit ('',$x,$y,$w,$h,BitOR ($ES_READONLY,$WS_TABSTOP,$WS_VSCROLL)) $ehwnd = GUICtrlGetHandle ($CtrlID) $msg = $FROM & ' Says:' & $msg If $TO == $FROM Then GUICtrlSetBkColor ($CtrlID,0xFEDCBA) EndIf _GUICtrlEdit_AppendText($ehwnd,$msg) SetFocus ($TO) EndFunc Func SetFocus ($IP) If WinActive ($IP) Or WinActive ($IP&'SCROLL') Or WinActive ($IP&'INPUT') Then $hwnd = ControlGetHandle ($IP&'INPUT','','Edit1') $CtrlID = _WinAPI_GetDlgCtrlID ($hwnd) GUICtrlSetState ($CtrlID,256) EndIf EndFunc Func BroadCastToALL () Local $n For $n = 1 To $NIC_Count If $Network_Adapter_Info_Array[$n][5] = -1 Then ContinueLoop Else ;BroadCasts the NIC's IPAddress, To The NIC's BROADCAST IP. ;------------------------------------------- UDP_Send ($Network_Adapter_Info_Array[$n][5],'[online]=' & $Network_Adapter_Info_Array[$n][1]) ;------------------------------------------- EndIf Next EndFunc Func UDP_Send ($socket_array,$msg) UDPSend ($socket_array,$msg) If @error Then MsgBox (48,'ERROR','UDP_Send:'& @error & @CR & $msg,10,WinGetHandle ('[active]')) EndFunc Func ClickedChat () Local $thWnd, $tphWnd,$text,$IP, $array $thWnd = _GUICtrlTreeView_GetSelection($hWnd_TreeView) $tphWnd = _GUICtrlTreeView_GetParentHandle($hWnd_TreeView, $thWnd) If _GUICtrlTreeView_GetText($hWnd_TreeView,$tphWnd) == 'IP Listing' Then ;------------------------------------------- ;IP LISTING ;------IP1 ;------IP2 ;------IPn $IP = _GUICtrlTreeView_GetText($hWnd_TreeView,$thWnd) ;------------------------------------------- CreateNewWindow ($IP) EndIf EndFunc Func buttonSendMessage () Local $IP, $msg, $n,$Socket $IP = WinGetTitle (_WinAPI_GetParent (@GUI_WinHandle)) $Msg = ControlGetText (@GUI_WinHandle,'','Edit1') ControlSetText (@GUI_WinHandle,'','Edit1','') For $n = 1 To $NIC_Count If StringInStr ($NIC_IP_LIST[$n],'[' & $IP & ']') Then $Socket = UDPOpen ($Ip,$Network_Adapter_Info_Array[$n][3]) ;Opens A Specific SOCKET for sending to a specific client. If @error Then MsgBox (48,'ERROR','ERROR-CODE=' & @error,10,WinGetHandle ('[active]')) Else UDP_Send ($Socket,'[msg]=' & $IP & Chr (31) & $Msg & Chr (31) & $Network_Adapter_Info_Array[$n][1]) If @error Then $msg = '' If -1 >= @error >= -3 Then $msg = 'INVALID SOCKET ARRAY' If @error = 1 Then $Msg = 'INVALID IP' If @error = 2 Then $Msg = 'INVALID PORT' MsgBox (48,'ERROR','ERROR-CODE=' & @error & @CRLF & $GUID_KEY_ARRAY[$n] & @CRLF & $msg,10,WinGetHandle ('[active]')) Else Addmessage ($IP,$msg,$Network_Adapter_Info_Array[$n][1]) EndIf EndIf UDPCloseSocket ($Socket) ;closes the specific socket. Return EndIf Next EndFunc Func SetWindowColors ($hwnd) GUISetBkColor (0xABCDEF,$hwnd) GUICtrlSetDefColor (0xFFFFFF,$hwnd) GUICtrlSetDefBkColor (0xABCDEF,$hwnd) GUISetFont (10,999,'','Tahoma',$hwnd) EndFunc Func CreateNewWindow ($title) Local $wp, $hp, $parent, $x,$y,$w,$h,$child_input,$child_scroll,$aRet, $CtrlID, $cw, $ch If WinExists ($title) Then Return $wp = @DesktopWidth/2 $hp = @DesktopHeight/2 $parent = GUICreate ($title,$wp,$hp,Default,Default,$WS_POPUPWINDOW) $cw = _WinAPI_GetClientWidth ($parent) $ch = _WinAPI_GetClientHeight ($parent) SetWindowColors ($parent) GUISetOnEvent (-3,'CloseWindow',$parent) $CtrlID = GUICtrlCreateLabel ($title,0,0,$wp-$buttonheight*2,$hp,Default,0x00100000) $CtrlID = GUICtrlCreateLabel ('CLOSE',$wp-$buttonheight*2,0,$buttonheight*2,$buttonheight,BitOR ($SS_CENTER,$SS_CENTERIMAGE)) GUICtrlSetOnEvent ($CtrlID,'CloseWindow') GUICtrlSetCursor ($CtrlID,0) $CtrlID = GUICtrlCreateLabel ('',$wp-$buttonheight*2,$buttonheight,$buttonheight*2,$hp-$buttonheight,Default,0x00100000) ;-------------------------------------------------------------------------------------------------------------------- ;THIS makes a child window, specifically for scrolling through posts between two people. $x = $buttonheight/2 $y = $buttonheight*2.5 $w = $cw-$buttonheight $h = ($ch-($buttonheight*5.5)) $child_scroll = GUICreate ($title&'SCROLL',$w,$h,$x,$y,$WS_POPUPWINDOW,$WS_EX_MDICHILD,$parent) SetWindowColors ($child_scroll) _GUIScrollBars_Init($child_scroll) $aRet = _GUIScrollbars_Size(0, $h, $w, $h) _GUIScrollBars_ShowScrollBar($child_scroll, $SB_HORZ, False) _GUIScrollBars_SetScrollInfoPage($child_scroll, $SB_VERT, $aRet[2]) _GUIScrollBars_SetScrollInfoMax($child_scroll, $SB_VERT, $aRet[3]) ;-------------------------------------------------------------------------------------------------------------------- ;THIS creates a child window to SEND messages to the other person $x = $buttonheight/2 $y = $h+($buttonheight*3) $w = $cw-$buttonheight $h = $buttonheight*2 $child_input = GUICreate ($title&'INPUT',$w,$h,$x,$y,$WS_POPUPWINDOW,$WS_EX_MDICHILD,$parent) SetWindowColors ($child_input) $x = 0 $y = 0 $w = $buttonheight * 2 $h = $buttonheight * 2 $cw = _WinAPI_GetClientWidth ($child_input) $ch = _WinAPI_GetClientHeight ($child_input) $CtrlID = GUICtrlCreateButton ('Send',$cw-$w,0,$w,$h) GUICtrlSetOnEvent ($CtrlID,'buttonSendMessage') $CtrlID = GUICtrlCreateInput ('Type Here...',$x,$y,$cw-$w,$h,BitOR ($WS_VSCROLL,$ES_MULTILINE)) GUICtrlSetState ($CtrlID,256) GUISetState (@SW_SHOW, $parent) GUISetState (@SW_SHOW, $child_input) GUISetState (@SW_SHOW, $child_scroll) ;~ _WinAPI_SetWindowLong ($parent,$GWL_EXSTYLE,BitOR (_WinAPI_GetWindowLong ($parent,$GWL_EXSTYLE),$WS_EX_LAYERED)) ;~ _WinAPI_SetWindowLong ($child_scroll,$GWL_EXSTYLE,BitOR (_WinAPI_GetWindowLong ($child_scroll,$GWL_EXSTYLE),$WS_EX_LAYERED)) ;~ _WinAPI_SetWindowLong ($child_input,$GWL_EXSTYLE,BitOR (_WinAPI_GetWindowLong ($child_input,$GWL_EXSTYLE),$WS_EX_LAYERED)) ;~ _WinAPI_SetLayeredWindowAttributes ($parent,0xABCDEFa,170) ;~ _WinAPI_SetLayeredWindowAttributes ($child_scroll,0xABCDEFa,255) ;~ _WinAPI_SetLayeredWindowAttributes ($child_input,0xABCDEFa,255) EndFunc Func Startup_Every_NIC ($Instance) Local $Ip, $Port, $GUID, $SubnetMask, $Bind,$Open, $Interfaces, $Ip_Array,$Subnet_Array, $CtrlID, $n ;For Each Specified INSTANCE, This Gets The UNIQUE ID for the NIC ;------------------------------------------- $GUID = RegRead ($NetworkCards & RegEnumKey ($NetworkCards,$Instance),'ServiceName') $Interfaces = 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters\Interfaces\' & $GUID ;------------------------------------------- If RegRead ($Interfaces,'EnableDHCP') = Hex(1) Then ;If this uses a DHCP connection then it MUST use the DHCP IP and SUBNET $IPAddress = RegRead ($Interfaces,'DhcpIPAddress') If @error Then $IPAddress = RegRead ($Interfaces,'IPAddress') ;If it doesn't have an element for the IP then it uses the DEFAULT IP. $SubnetMask = RegRead ($Interfaces,'DhcpSubnetMask') If @error Then $SubnetMask = RegRead ($Interfaces,'SubnetMask') ;If it doesn't have an element for the SUBNET then it uses the DEFAULT SUBNET. Else $IPAddress = RegRead ($Interfaces,'IPAddress') $SubnetMask = RegRead ($Interfaces,'SubnetMask') EndIf ;splits the addresses into octets $Subnet_Array = StringSplit ($SubnetMask,'.') $Ip_Array = StringSplit ($IPAddress,'.') ;creates a broadcasting IP based on how many possible IPs are in the specified SUBNET. For $n = 1 To 4 $Ip_Array[$n] = BitAND ($Ip_Array[$n],$Subnet_Array[$n]) If $Subnet_Array[$n] = 0 Then $Ip_Array[$n] = '255' Next $Ip = $Ip_Array[1] & '.' & $Ip_Array[2] & '.' & $Ip_Array[3] & '.' & $Ip_Array[4] $Port = 49150 $GUID_KEY_ARRAY[$Instance] = $GUID $NIC_IP_LIST[$Instance] = $GUID $Network_Adapter_Info_Array[$Instance][0] = $SubnetMask $Network_Adapter_Info_Array[$Instance][1] = $IPAddress $Network_Adapter_Info_Array[$Instance][2] = $Ip $Network_Adapter_Info_Array[$Instance][3] = $Port If $Network_Adapter_Info_Array[$Instance][0] == '0.0.0.0' Or $Network_Adapter_Info_Array[$Instance][1] == '0.0.0.0' Then $Bind = -1 ;NON FUNCTIONAL NIC $Open = -1 ;NON FUNCTIONAL NIC Else $Bind = UDPBind ($Network_Adapter_Info_Array[$Instance][1],$Network_Adapter_Info_Array[$Instance][3]) If @error Then $Bind = -1 ;NON FUNCTIONAL NIC $Open = UDPOpen ($Network_Adapter_Info_Array[$Instance][2],$Network_Adapter_Info_Array[$Instance][3]) If @error Then $Open = -1 ;NON FUNCTIONAL NIC EndIf ;--------------------SERVER SOCKET, Opened On Local IP-------------------- $Network_Adapter_Info_Array[$Instance][4] = $Bind ;---------------------------------------------------------------------- ;--------------------BroadCasting Socket Opened On BroadCasting IP-------------------- $Network_Adapter_Info_Array[$Instance][5] = $Open ;-------------------------------------------------------------------------------- ;----------Create A ITEM for each NIC---------- $GUID_TreeView_ID[$Instance][0] = _GUICtrlTreeView_Add ($hWnd_TreeView,0,$GUID_KEY_ARRAY[$Instance]) If $Network_Adapter_Info_Array[$Instance][4] = -1 Or $Network_Adapter_Info_Array[$Instance][5] = -1 Then _GUICtrlTreeView_SetIcon($hWnd_TreeView,$GUID_TreeView_ID[$Instance][0],@SystemDir & '\Shell32.dll',109) ;-------------------------------------------------- ;----------Creates Information For That NIC $GUID_TreeView_ID[$Instance][1] = _GUICtrlTreeView_AddChild ($hWnd_TreeView,$GUID_TreeView_ID[$Instance][0],'Information') _GUICtrlTreeView_SetIcon($hWnd_TreeView, $GUID_TreeView_ID[$Instance][1],@SystemDir & '\Shell32.dll',54) ;---------------------------------------- ;----------Subnet IP---------- $CtrlID = _GUICtrlTreeView_AddChild ($hWnd_TreeView,$GUID_TreeView_ID[$Instance][1],'Subnet: '& $Network_Adapter_Info_Array[$Instance][0]) _GUICtrlTreeView_SetIcon($hWnd_TreeView,$CtrlID,@SystemDir & '\Shell32.dll',18) ;------------------------------ ;----------Local IP---------- $CtrlID = _GUICtrlTreeView_AddChild ($hWnd_TreeView,$GUID_TreeView_ID[$Instance][1],'Local IP: '& $Network_Adapter_Info_Array[$Instance][1]) _GUICtrlTreeView_SetIcon($hWnd_TreeView,$CtrlID,@SystemDir & '\Shell32.dll',69) ;------------------------------ ;----------BroadCasting IP---------- $CtrlID = _GUICtrlTreeView_AddChild ($hWnd_TreeView,$GUID_TreeView_ID[$Instance][1],'BroadCasting IP: '& $Network_Adapter_Info_Array[$Instance][2]) _GUICtrlTreeView_SetIcon($hWnd_TreeView,$CtrlID,@SystemDir & '\Shell32.dll',69) ;---------------------------------------- ;----------Port number---------- $CtrlID = _GUICtrlTreeView_AddChild ($hWnd_TreeView,$GUID_TreeView_ID[$Instance][1],'Port: '& $Network_Adapter_Info_Array[$Instance][3]) _GUICtrlTreeView_SetIcon($hWnd_TreeView,$CtrlID,@SystemDir & '\Shell32.dll',69) ;------------------------------ ;----------Creates An IP List---------- $GUID_TreeView_ID[$Instance][2] = _GUICtrlTreeView_AddChild ($hWnd_TreeView,$GUID_TreeView_ID[$Instance][0],'IP Listing') _GUICtrlTreeView_SetIcon($hWnd_TreeView, $GUID_TreeView_ID[$Instance][2],@SystemDir & '\Shell32.dll',17) ;---------------------------------------- Return EndFunc Func CloseWindow () GUIDelete (@GUI_WinHandle) EndFunc Func _Exit() Local $status, $n If $UDP = True Then For $n = 1 To $NIC_Count If $Network_Adapter_Info_Array[$n][5] <> -1 Then UDP_Send ($Network_Adapter_Info_Array[$n][5],'[offline]=' & $Network_Adapter_Info_Array[$n][1]) ;BroadCasts a goodbye Message. UDPCloseSocket ($Network_Adapter_Info_Array[$n][4]) UDPCloseSocket ($Network_Adapter_Info_Array[$n][5]) Next UDPShutdown() EndIf Exit EndFunc
EDIT: cleaned up a few lines.
Edited by CodyBarrett, 15 November 2010 - 04:59 PM.





