Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/Win/Windows Network Information
Function:
Required plugins for this example: MBS Network Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Win/Windows Network Information
This example is the version from Sun, 17th Mar 2012.
Project "Windows Network Information.rbp"
Class Window1 Inherits Window
Control Liste Inherits ListBox
ControlInstance Liste Inherits ListBox
End Control
EventHandler Sub Open() dim we as WindowsEthernetMBS dim wi as WindowsIPAddressMBS dim wa as WindowsEthernetAdapterMBS dim i,c as integer dim ii,cc as integer dim s as String if TargetMacOS then MsgBox "This example works only on Microsoft Windows 98 or newer." end if we=new WindowsEthernetMBS c=we.Count Liste.AddRow str(c)+" Adapter" c=c-1 for i=0 to c wa=we.Item(i) if wa<>Nil then Liste.AddRow str(wa.Index)+". Adapter:" Liste.AddRow " AdapterName: "+wa.AdapterName Liste.AddRow " Description: "+wa.Description Liste.AddRow " Address: "+HardwareAddress(wa.Address) Liste.AddRow " DhcpEnabled: "+Bool(wa.DhcpEnabled) Liste.AddRow " DhcpServer: "+IP(wa.DhcpServer) Liste.AddRow " PrimaryWinsServer: "+IP(wa.PrimaryWinsServer) Liste.AddRow " SecondaryWinsServer: "+IP(wa.SecondaryWinsServer) Liste.AddRow " IPcount: "+str(wa.IPcount) cc=wa.IPcount-1 for ii=0 to cc wi=wa.IP(ii) if wi=wa.CurrentIpAddress then s=" (Current)" else s="" end if Liste.AddRow " IP: "+IP(wi)+s next Liste.AddRow " Gatewaycount: "+str(wa.Gatewaycount) cc=wa.Gatewaycount-1 for ii=0 to cc Liste.AddRow " Gateway: "+IP(wa.Gateway(ii)) next end if next End EventHandler
Function Bool(b as boolean) As string if b then Return "Yes" else Return "No" end if End Function
Function HardwareAddress(s as string) As string dim i,c as integer dim t as String dim n as integer c=len(s) for i=1 to c n=asc(mid(s,i,1)) if n<16 then t=t+"0" end if t=t+hex(n) if i<c then t=T+":" end if next Return t End Function
Function IP(wi as windowsipAddressMBS) As string if wi<>nil then if wi.Mask<>"" then Return wi.IP+" / "+wi.Mask else Return wi.ip end if else Return "n/a" end if End Function
End Class
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu0 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
End Class
End Project

See also:

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS Win Plugin.




Links
MBS Xojo Plugins