VB-获取本机计算机名,登录名、ip地址

真的是很简单,执行结果:Computer:不平凡总在于坚持  User:Administrator  IP:192.168.0.111

    '获取计算机名、用户名、本机ip
    Dim LocalInfo As String
    Dim strLocalIP As String
    Dim winIP As Object
    LocalInfo = LocalInfo & "  Computer:" & Environ("computername")
    LocalInfo = LocalInfo & "  User:" & Environ("username")
    Set winIP = CreateObject("MSWinsock.Winsock")
    strLocalIP = winIP.localip
    LocalInfo = LocalInfo & "  IP:" & strLocalIP
  Debug.Print LocalInfo  
 
posted @ 2014-07-28 23:00  不平凡总在于坚持!  阅读(1239)  评论(0编辑  收藏  举报