473,414 Members | 1,627 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Obtain IP address via VBA ?

HB2
Is it possible to obtain the IP address of my desktop using a Visual Basic
command?
Nov 13 '05 #1
5 23038
On Sun, 12 Dec 2004 23:02:48 GMT, "HB2" <bg******@comcast.net> wrote:

The desktop doesn't have an IP address. It has a window handle, if
that's what you want.
"localhost" is the generic name of the local web server, and its
address per definition is 127.0.0.1

-Tom.

Is it possible to obtain the IP address of my desktop using a Visual Basic
command?


Nov 13 '05 #2

"HB2" <bg******@comcast.net> wrote in message
news:n64vd.647107$mD.275603@attbi_s02...
Is it possible to obtain the IP address of my desktop using a Visual Basic
command?


You mean your desktop computer?

You can use the winsock control, and it takes a bit of setup. There's a
newsgroup, alt.winsock I think, that can probably point you to some sample
code.
Nov 13 '05 #3
Try:

http://www.mvps.org/access/api/api0067.htm
On Sun, 12 Dec 2004 23:02:48 GMT, "HB2" <bg******@comcast.net> wrote:
Is it possible to obtain the IP address of my desktop using a Visual Basic
command?

**********************
ja**************@telusTELUS.net
remove uppercase letters for true email
http://www.geocities.com/jacksonmacd/ for info on MS Access security
Nov 13 '05 #4
You may need the following as well

Private Declare Function GetComputerName Lib "kernel32" Alias
"GetComputerNameA" ( _
ByVal lpBuffer As String, _
nSize As Long _
) As Long

Private Const MAX_COMPUTERNAME_LENGTH = 31

Function ThisComputerName() As String
Dim lpBuffer As String
Dim nSize As Long
Dim lngRet As Long

nSize = MAX_COMPUTERNAME_LENGTH + 1
lpBuffer = Space(nSize)
lngRet = GetComputerName(lpBuffer, nSize)
If lngRet <> 0 Then
ThisComputerName = Left(lpBuffer, nSize)
End If
End Function

You can then call
Dim strIP as string

strIP = fGetHostIPAddresses(ThisComputerName)(1)

which should give you the IP address of the computer you are on.
--
Terry Kreft
MVP Microsoft Access
"Jack MacDonald" <ja**************@telus.net> wrote in message
news:30********************************@4ax.com...
Try:

http://www.mvps.org/access/api/api0067.htm
On Sun, 12 Dec 2004 23:02:48 GMT, "HB2" <bg******@comcast.net> wrote:
Is it possible to obtain the IP address of my desktop using a Visual Basiccommand?

**********************
ja**************@telusTELUS.net
remove uppercase letters for true email
http://www.geocities.com/jacksonmacd/ for info on MS Access security

Nov 13 '05 #5
On Sun, 12 Dec 2004 23:02:48 GMT, "HB2" <bg******@comcast.net> wrote:
Is it possible to obtain the IP address of my desktop using a Visual Basic
command?

Hi
If you want the external (WAN) address in general you have to find it
from outside your own environment, see for example the freeware
program MyWANIP
http://www.mywanip.com/

You can use this to put the address on the clipboard.
David
Nov 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Privacy Advocate | last post by:
//crossposted to: comp.lang.javascript, alt.comp.lang.javascript in an effort to get factual answers from JavaScript experts// Simply put; Is it possible to obtain the real (actual) IP address of...
5
by: Jeronimo Bertran | last post by:
Hello, We have developed a socket tcpip server in .net that accepts calls from clients. Using the connected socket we are able to use the Socket.RemoteEndPoint to obtain the IP address of the...
22
by: ypjofficial | last post by:
Hello All, While readling the C and C++ literature i came to know that the OS allocates separate protected memory space for each running program and the program do not interfare into one another's...
33
by: baumann.Pan | last post by:
hi all, i want to get the address of buf, which defined as char buf = "abcde"; so can call strsep(address of buf, pointer to token);
4
by: Ed Willis | last post by:
We have several offices that have a DSL or Cable modem where the IP address is dynamic and changes often. I created a VB app that obtains the IP address but it obtains the IP address within the...
4
by: stuff | last post by:
Is it possible to obtain the client's ip address from a SimpleXMLRPCServer instance or subclass instance? When running SimpleXMLRPCServer with logRequests = 1, the xmlrpc server prints out the...
0
by: ngr | last post by:
I want to be able to retrieve an ip address: At the moment I have to do the following OBTAIN A DOS WINDOW ROUTE PRINT From this I obtain the IP Address from the dos window thus.... Network...
5
by: Peggy | last post by:
Hello, I have a web application running on IIS, What I wanna do is to obtain server's ethernet card's mac address in order to use this address for licensing issues I have developed my web...
7
by: Brian Cryer | last post by:
What I'm looking for is a way to tell if two sessions are from the same physical PC or from different PCs (within the same organisation say). This is with the view to possibly enforcing license...
0
by: leonardo.schmidt | last post by:
Due to some connectivity problems with a client's VPN software, I'm developing an app that needs to obtain the current logged user's Exchange server address & add a new route (among other...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.