可以,在bas文件里面:
Type Inet_address
    Byte4 As String * 1
    Byte3 As String * 1
    Byte2 As String * 1
    Byte1 As String * 1
End TypePublic IPLong As Inet_addressType Hostent
    h_name As Long
    h_aliases As Long
    h_addrtype As Integer
    h_length As Integer
    h_addr_list As Long
End Type
Declare Function gethostbyname& Lib "wsock32.dll" (ByVal hostname$)
Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long)在frm文件里面:
Private Sub Command1_Click()
Dim PointerToPointer As Long
Dim ListAddress As Long
Dim Addr As Long
If gethostbyname("www.sohu.com") = SOCKET_ERROR Then
        MsgBox "未找到此地址,请检查网络是否已经连通.", vbOKOnly, "错误"
    Else
        PointerToPointer = gethostbyname("www.sohu.com")
        CopyMemory Hostent.h_name, ByVal _
        PointerToPointer, Len(Hostent)        ListAddress = Hostent.h_addr_list
        CopyMemory ListAddr, ByVal ListAddress, 4
        CopyMemory IPLong, ByVal ListAddr, 4
        CopyMemory Addr, ByVal ListAddr, 4        IP地址 = CStr(Asc(IPLong.Byte4)) + "." + CStr(Asc(IPLong.Byte3)) _
            + "." + CStr(Asc(IPLong.Byte2)) + "." + CStr(Asc(IPLong.Byte1))
    End If
End Sub