$PBExportHeader$w_main.srw forward global type w_main from window end type type ddlb_ipaddress from dropdownlistbox within w_main end type type sle_publicipaddress from singlelineedit within w_main end type type st_1 from statictext within w_main end type type sle_hostname from singlelineedit within w_main end type type cbx_ipversion from checkbox within w_main end type type tab_main from u_tab_main within w_main end type type tab_main from u_tab_main within w_main end type type cb_cancel from commandbutton within w_main end type type st_8 from statictext within w_main end type type st_3 from statictext within w_main end type type cbx_setunicode from checkbox within w_main end type end forward global type w_main from window integer width = 3159 integer height = 2164 boolean titlebar = true string title = "Winsock Example" boolean controlmenu = true long backcolor = 67108864 string icon = "AppIcon!" boolean center = true event ue_get_host_ipaddr ( ) ddlb_ipaddress ddlb_ipaddress sle_publicipaddress sle_publicipaddress st_1 st_1 sle_hostname sle_hostname cbx_ipversion cbx_ipversion tab_main tab_main cb_cancel cb_cancel st_8 st_8 st_3 st_3 cbx_setunicode cbx_setunicode end type global w_main w_main type variables end variables event ue_get_host_ipaddr();Integer li_idx, li_max String ls_hostname, ls_ipaddress[], ls_publicip // trigger post open event tab_main.Event ue_postopen() // get the pc Hostname ls_hostname = gn_ws.of_GetHostName() sle_hostname.text = ls_hostname // get the local IP Addresses If Not gn_ws.of_GetIPAddress(ls_hostname, ls_ipaddress) Then MessageBox("Get IP Address Failed", & gn_ws.of_GetLastError(), StopSign!) Return End If // add local IP Addresses to dropdown ddlb_ipaddress.Reset() li_max = UpperBound(ls_ipaddress) For li_idx = 1 To li_max ddlb_ipaddress.AddItem(ls_ipaddress[li_idx]) Next ddlb_ipaddress.SelectItem(1) // get public IP Address If Not gn_ws.of_GetPublicIPAddress(ls_publicip) Then MessageBox("Get Public IP Address Failed", & gn_ws.of_GetLastError(), StopSign!) Return End If sle_publicipaddress.text = ls_publicip end event on w_main.create this.ddlb_ipaddress=create ddlb_ipaddress this.sle_publicipaddress=create sle_publicipaddress this.st_1=create st_1 this.sle_hostname=create sle_hostname this.cbx_ipversion=create cbx_ipversion this.tab_main=create tab_main this.cb_cancel=create cb_cancel this.st_8=create st_8 this.st_3=create st_3 this.cbx_setunicode=create cbx_setunicode this.Control[]={this.ddlb_ipaddress,& this.sle_publicipaddress,& this.st_1,& this.sle_hostname,& this.cbx_ipversion,& this.tab_main,& this.cb_cancel,& this.st_8,& this.st_3,& this.cbx_setunicode} end on on w_main.destroy destroy(this.ddlb_ipaddress) destroy(this.sle_publicipaddress) destroy(this.st_1) destroy(this.sle_hostname) destroy(this.cbx_ipversion) destroy(this.tab_main) destroy(this.cb_cancel) destroy(this.st_8) destroy(this.st_3) destroy(this.cbx_setunicode) end on event open;// get the Hostname & IP Address this.Event ue_get_host_ipaddr() end event event closequery;If gb_Listening Then MessageBox(this.title, & "Please stop listening before exiting the program!", StopSign!) Return 1 End If Return 0 end event type ddlb_ipaddress from dropdownlistbox within w_main event keypressed pbm_keydown integer x = 1902 integer y = 72 integer width = 1175 integer height = 1008 integer taborder = 20 integer textsize = -8 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" long textcolor = 33554432 borderstyle borderstyle = stylelowered! end type event keypressed;// send contents to clipboard on Ctrl-C If key = KeyC! And keyflags = 2 Then ClipBoard(this.text) End If end event type sle_publicipaddress from singlelineedit within w_main event keypressed pbm_keyup integer x = 1902 integer y = 200 integer width = 1175 integer height = 84 integer taborder = 30 integer textsize = -8 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" long textcolor = 33554432 boolean displayonly = true borderstyle borderstyle = stylelowered! end type event keypressed;// send contents to clipboard on Ctrl-C If key = KeyC! And keyflags = 2 Then ClipBoard(this.text) End If end event type st_1 from statictext within w_main integer x = 1417 integer y = 212 integer width = 485 integer height = 60 integer textsize = -8 integer weight = 700 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" long textcolor = 33554432 long backcolor = 67108864 string text = "Public IP Address: " alignment alignment = right! boolean focusrectangle = false end type type sle_hostname from singlelineedit within w_main event keypressed pbm_keydown integer x = 256 integer y = 72 integer width = 1065 integer height = 84 integer taborder = 10 integer textsize = -8 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" long textcolor = 33554432 boolean displayonly = true borderstyle borderstyle = stylelowered! end type event keypressed;// send contents to clipboard on Ctrl-C If key = KeyC! And keyflags = 2 Then ClipBoard(this.text) End If end event type cbx_ipversion from checkbox within w_main integer x = 805 integer y = 212 integer width = 370 integer height = 60 integer textsize = -8 integer weight = 700 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" long textcolor = 33554432 long backcolor = 67108864 string text = "Use IPv6" end type event clicked;If this.Checked Then gn_ws.of_SetIPVersion(6) gi_ipversion = 6 Else gn_ws.of_SetIPVersion(4) gi_ipversion = 4 End if // get the Hostname & IP Address Parent.Event ue_get_host_ipaddr() end event type tab_main from u_tab_main within w_main integer x = 73 integer y = 352 integer width = 3003 integer height = 1508 integer taborder = 40 end type type cb_cancel from commandbutton within w_main integer x = 2743 integer y = 1920 integer width = 334 integer height = 100 integer taborder = 50 integer textsize = -8 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" string text = "Cancel" boolean cancel = true end type event clicked;Close(Parent) end event type st_8 from statictext within w_main integer x = 1417 integer y = 84 integer width = 485 integer height = 60 integer textsize = -8 integer weight = 700 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" long textcolor = 33554432 long backcolor = 67108864 string text = "Local IP Address: " alignment alignment = right! boolean focusrectangle = false end type type st_3 from statictext within w_main integer x = 73 integer y = 84 integer width = 183 integer height = 60 integer textsize = -8 integer weight = 700 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" long textcolor = 33554432 long backcolor = 67108864 string text = "Host:" boolean focusrectangle = false end type type cbx_setunicode from checkbox within w_main integer x = 73 integer y = 212 integer width = 699 integer height = 60 integer textsize = -8 integer weight = 700 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" long textcolor = 33554432 long backcolor = 67108864 string text = "Send/Receive Unicode" boolean checked = true end type event clicked;gn_ws.of_SetUnicode(this.Checked) end event
File: w_main.srw
Size: 8141
Date: Mon, 31 Dec 2018 21:14:39 +0100
Size: 8141
Date: Mon, 31 Dec 2018 21:14:39 +0100
- window w_main(srw)
- dropdownlistbox ddlb_ipaddress
- singlelineedit sle_publicipaddress
- statictext st_1
- singlelineedit sle_hostname
- checkbox cbx_ipversion
- u_tab_main tab_main
- commandbutton cb_cancel
- statictext st_8
- statictext st_3
- checkbox cbx_setunicode