Sub AppStart (Form1 As Form, Args() As String)
Dim jo As JavaObject = Me
jo.RunMethod("PrintAllInterfaces", Null)
End Sub
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
Return True
End Sub
#if JAVA
import java.net.NetworkInterface;
import java.util.Enumeration;
public static void PrintAllInterfaces() throws Exception {
for (Enumeration<NetworkInterface> e = NetworkInterface.getNetworkInterfaces(); e.hasMoreElements();)
{
NetworkInterface network = e.nextElement();
byte[] mac = network.getHardwareAddress();
if (mac != null) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < mac.length; i++) {
sb.append(String.format("%02X%s", mac[i], (i < mac.length - 1) ? "-" : ""));
}
//Interface properties
System.out.println("Current MAC address : " + sb.toString() +"\r\n");
System.out.println(network.getDisplayName());
System.out.println(network.getName());
}
}
}
#End If