gaofeng 发表于 2014-7-30 09:07:13

用VB 6.0怎样获得本机IP地址?

请教怎样用VB6.0获得本机IP地址,写上注释,最好代码简单易懂.
谢谢,很着急,在线等
不用第一楼方法不可行,第二楼不用控件,请问谁有别的办法获取本机IP,最好写上注释,

tony_sun76421 发表于 2014-7-30 09:07:23

Private Sub Command1_Click()
Dim aa As String
Dim strLocalIP As String
Dim winIP As Object
aa = aa & "本机电脑名称:" & Environ("computername") & vbCrLf
aa = aa & "本机用户名称:" & Environ("username") & vbCrLf
Set winIP = CreateObject("MSWinsock.Winsock")
strLocalIP = winIP.localip
MsgBox aa & "本机IP:" & strLocalIP
End Sub
页: [1]
查看完整版本: 用VB 6.0怎样获得本机IP地址?