Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8955385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:32:34+00:00 2026-06-15T14:32:34+00:00

How can I obtain the local IP addres in VB6 without using Winsock control

  • 0

How can I obtain the local IP addres in VB6 without using Winsock control

The reason I dont want to use or need Winsock is because my application should work offline.

I’m a bit new to VB6 and my search on this subject failed. I suppose that I need some WinAPI’s and any pointer or code example would be appreciable.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T14:32:35+00:00Added an answer on June 15, 2026 at 2:32 pm

    This was taken from here: VB Function to Find the IP Address

    Private Declare Function GetIpAddrTable_API Lib "IpHlpApi" Alias "GetIpAddrTable" (pIPAddrTable As Any, pdwSize As Long, ByVal bOrder As Long) As Long
    
    ' Returns an array with the local IP addresses (as strings).
    ' Author: Christian d'Heureuse, www.source-code.biz
    Public Function GetIpAddrTable()
       Dim Buf(0 To 511) As Byte
       Dim BufSize As Long: BufSize = UBound(Buf) + 1
       Dim rc As Long
       rc = GetIpAddrTable_API(Buf(0), BufSize, 1)
       If rc <> 0 Then Err.Raise vbObjectError, , "GetIpAddrTable failed with return value " & rc
       Dim NrOfEntries As Integer: NrOfEntries = Buf(1) * 256 + Buf(0)
       If NrOfEntries = 0 Then GetIpAddrTable = Array(): Exit Function
       ReDim IpAddrs(0 To NrOfEntries - 1) As String
       Dim i As Integer
       For i = 0 To NrOfEntries - 1
          Dim j As Integer, s As String: s = ""
          For j = 0 To 3: s = s & IIf(j > 0, ".", "") & Buf(4 + i * 24 + j): Next
          IpAddrs(i) = s
          Next
       GetIpAddrTable = IpAddrs
       End Function
    
    
    
    ' Test program for GetIpAddrTable.
    Public Sub Test()
       Dim IpAddrs
       IpAddrs = GetIpAddrTable
       Debug.Print "Nr of IP addresses: " & UBound(IpAddrs) - LBound(IpAddrs) + 1
       Dim i As Integer
       For i = LBound(IpAddrs) To UBound(IpAddrs)
          Debug.Print IpAddrs(i)
          Next
       End Sub
    

    I tested it on my machine, it resulted in 2 IpAddrs. I would usually consider the 2nd one to be my actual one.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I obtain kerning information for GDI to then use in GetKerningPairs ?
JComponents can obtain hidden data using setName() and getName() , right? What about JComboBox
Whilst inside an iframe, can you please let me know how I can obtain
I have a Version class that contains a version_number string, and can obtain a
Can I obtain the source code for the core Ada libraries? I'd like to
How can I obtain the count of faulted messages from a Windows Azure Storage
How can I obtain the physical machine name that my jvm is running in?
How can you obtain the system clock's current time of day (in milliseconds) in
we have that string: I like to eat apple How can I obtain the
I have starter new System.Diagnostics.Process and it launchs FireFox. How can I obtain the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.