[dba-VB] Syslogs

Drew Wutka DWUTKA at Marlow.com
Tue Jun 30 11:28:48 CDT 2009


There are several ways to get your IP address.  Two I've used is to use
a Winsock control, and look at the local host IP.

Another relatively easy way is to dump the results of IPCONFIG to a text
file.

Create a .bat file (call it iptest.bat) and put the following line in
it:

Ipconfig >C:\ip.txt

Then using ShellWait (http://mvps.org/access/api/api0004.htm)

Use this function:

Function IPAddresses() As String
Dim f As Long
Dim strTemp As String
Dim strArray() As String
If Dir("C:\ip.txt") <> "" Then Kill "C:\ip.txt"
ShellWait "C:\iptest.bat"
f = FreeFile
Open "C:\ip.txt" For Binary Access Read As f
strTemp = Space(LOF(f))
Get f, , strTemp
Close f
strArray = Split(strTemp, vbCrLf)
strTemp = ""
For f = 0 To UBound(strArray)
    If InStr(1, strArray(f), "IPv4", vbTextCompare) > 0 Or InStr(1,
strArray(f), " IP Address", vbTextCompare) > 0 Then
        strTemp = strTemp & Trim(Mid(strArray(f), InStr(1, strArray(f),
":", vbBinaryCompare) + 1)) & ";"
    End If
Next f
If Len(strTemp) > 0 Then strTemp = Left(strTemp, Len(strTemp) - 1)
IPAddresses = strTemp
End Function

Whalla, IPAddresses will return as a semicolon delimited string.
(Obviously you could return an array or create a collection too...either
way....)

Drew
-----Original Message-----
From: dba-vb-bounces at databaseadvisors.com
[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby
Sent: Monday, June 29, 2009 11:38 AM
To: Discussion concerning Visual Basic and related programming issues.
Subject: Re: [dba-VB] Syslogs

LOL, but you still have to know your own IP address.  We got into this
one time, with Hamachi, VMs, 
multiple NICS etc. it is difficult to determine what my own IP address
is.

John W. Colby
www.ColbyConsulting.com


Gustav Brock wrote:
> Hi John
> 
> Ask the application to send you a syslog message! 
> Then you can read the sender address or hostname.
> 
> /gustav
> 
> 
>>>> jwcolby at colbyconsulting.com 29-06-2009 17:52 >>>
> Hmm...
> 
> Looks quite cool.
> 
> My mind is a raging torrent, flooded with rivulets of thought
cascading into a waterfall of creative 
> alternatives.
> 
> Now... how do we determine the IP address of every machine using an
Access application on the local LAN?
> 
> John W. Colby
> www.ColbyConsulting.com 
> 
> 
> Susan Harkins wrote:
>> <http://www.devx.com:80/vb/Article/42242/0/page/1>
>>
>> I'm so proud... ;) <sniff> Notice, my name is NOT in the byline...
I'm so 
>> proud... yet another ones passes safely to single author status. :)
>>
>> Susan H. 
> 
> 
> 
> _______________________________________________
> dba-VB mailing list
> dba-VB at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-vb
> http://www.databaseadvisors.com
> 
> 
_______________________________________________
dba-VB mailing list
dba-VB at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-vb
http://www.databaseadvisors.com

The information contained in this transmission is intended only for the person or entity 
to which it is addressed and may contain II-VI Proprietary and/or II-VI Business 
Sensitive material. If you are not the intended recipient, please contact the sender 
immediately and destroy the material in its entirety, whether electronic or hard copy. 
You are notified that any review, retransmission, copying, disclosure, dissemination, 
or other use of, or taking of any action in reliance upon this information by persons 
or entities other than the intended recipient is prohibited.





More information about the dba-VB mailing list