VB6.0 如何获得本机的IP和mac地址?
如题,多谢!
[解决办法]
component inet or winsock
[解决办法]
WMI
[解决办法]
Socket组件可以获得IP等信息。
Socket.HostIP吧,记不清楚了。
Socket和Mac都可以调用API获得
[解决办法]
利用Winsock控件
[解决办法]
Private Sub Command1_Click()
Dim oAdapters As Object, oAdapter As Object
On Error Resume Next
Set oAdapters = GetObject( "winmgmts: ").ExecQuery( "SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True ")
For Each oAdapter In oAdapters
MsgBox "MAC ADDRESS: " & Replace(oAdapter.macaddress, ": ", " ")
Exit For
Next
End Sub
[解决办法]
微软技术文章:
http://support.microsoft.com/kb/q160215/