从品牌网站建设到网络营销策划,从策略到执行的一站式服务
做exe程序获取本机IP地址用
创新互联是一家专注于网站制作、成都网站设计与策划设计,金平网站建设哪家好?创新互联做网站,专注于网站建设十余年,网设计领域的专业建站公司;建站业务涵盖:金平等地区。金平做网站价格咨询:028-86922220
System.Net.Dns.GetHostByName(System.Net.Dns.GetHostName()).AddressList
做web程序获取客户端的IP地址用
HttpContext.Current.Request.ServerVariables("REMOTE_ADDR"])
Dim IPAdress As System.Net.IPAddress
HostName = System.Net.Dns.GetHostName '获得本机的机器名
IPAdress = System.Net.Dns.GetHostByName(HostName).AddressList.GetValue(0) '获得本机的IP
Me.TextBox1.Text = HostName '本机机器名
Me.TextBox2.Text = IPAdress.ToString '本机的IP
定义以下过程即可获取本机ip地址
Sub GetMyIP()
Dim strComputer As String
Dim objWMI As Object
Dim colIP As Object
Dim IP As Object
Dim I As Integer
strComputer = "."
Set objWMI = GetObject("winmgmts://" strComputer "/root/cimv2")
Set colIP = objWMI.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
For Each IP In colIP
If Not IsNull(IP.IPAddress) Then
For I = LBound(IP.IPAddress) To UBound(IP.IPAddress)
MsgBox "IP 地址:" IP.IPAddress(I) Chr(10) _
Next
End If
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim cc() As System.Net.IPAddress = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName()).AddressList
Dim str As String = ""
For Each ws In cc
str = str ws.ToString vbCrLf
Next
MsgBox(str)
End Sub
成都网站建设公司地址:成都市青羊区太升南路288号锦天国际A座10层 建设咨询028-86922220
成都快上网科技有限公司-四川网站建设设计公司 | 蜀ICP备19037934号 Copyright 2020,ALL Rights Reserved cdkjz.cn | 成都网站建设 | © Copyright 2020版权所有.
专家团队为您提供成都网站建设,成都网站设计,成都品牌网站设计,成都营销型网站制作等服务,成都建网站就找快上网! | 成都网站建设哪家好? | 网站建设地图