Hi: I try to use the api function AddIpAddress in VB.net, the definition is: DWORD AddIPAddress( IPAddr Address, IPMask IpMask, DWORD IfIndex, PULONG NTEContext, PULONG NTEInstance ); I declare this function in VB.net Declare Function AddIPAddress Lib "Iphlpapi" (ByVal Address As UInt64, ByRef IpMask As UInt64, ByRef IfIndex As Integer, ByVal NTEContext As IntPtr, ByVal NTEInstance As IntPtr) As Integer and because I need convert Ip sting to IPAddr, use the function inet_addr with this definition: unsigned long inet_addr( const char* cp ); in VB.net Private Declare Function inet_addr Lib "WSOCK32.DLL" (ByVal cp As IntPtr) As UInt64 when I call this function : Dim ip_str As String Dim mask_str As String Dim NTEContext As IntPtr Dim NTEInstance As IntPtr Dim iRetVal As Integer Dim ptr_ip As IntPtr = IntPtr.Zero Dim ptr_mask As IntPtr = IntPtr.Zero Dim IPAddress As UInt64 Dim IPMask As UInt64 ip_str = "192.168.0.100" ptr_ip = Marshal.StringToHGlobalAnsi(ip_str) IPAddress = inet_addr(ptr_ip) mask_str = "255.255.255.0" ptr_mask = Marshal.StringToHGlobalAnsi(mask_str) IPMask = inet_addr(ptr_mask) iRetVal = AddIPAddress(IPAddress, IPMask, 1, NTEContext, NTEInstance) 'in this case 1 is the Ifindex of the loopback interface iRetVal = AddIPAddress(IPAddress, IPMask, 16777219, NTEContext, NTEInstance) ' in this case 16777219 is the IfIndex of the ethernet interface y get this number with GetIfTable when I use the AddIPAddress the return value is 87, INVALID_PARAMETER, in both cases. I dont known what is the error, Can you help me? Thanks.