[dba-VB] Syslogs

Max Wanadoo max.wanadoo at gmail.com
Tue Jun 30 11:54:23 CDT 2009


John, going with what Stuart posted earlier. I integrated it into my work FE
and it works great.  What I have to do now is to get each FE to run the code
on startup, post the resultant IP and Host into my Login Table and BINGO.
When they log off, i just remove the entries from the LoginTable if I want
to.

If I then wanted to (as you do) to send a message I will know who is logged
on.  You could shell out to NET SEND USER MESSAGE to send the message, for
example Where USER is the returning Hostname from the routine and MESSAGE is
the text you want to send.

Ie,
Net Send Manager Hi'ya georgeous.

Ps - I am the manager.

Max



-----Original Message-----
From: dba-vb-bounces at databaseadvisors.com
[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby
Sent: 30 June 2009 17:44
To: Discussion concerning Visual Basic and related programming issues.
Subject: Re: [dba-VB] Syslogs

Yes, but then you have to do more.  IPConfig shows several IP addresses on
my work laptop.  One is 
the wireless, which only works when in range of a wireless network, one is a
physical NIC, and one 
is a Hamachi IP.  There could be even more.  On my server I have two
physical NICS and in theory 
each could have asked for an IP address.

So would the REAL IP address please stand up.

John W. Colby
www.ColbyConsulting.com


Drew Wutka wrote:
> 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

_______________________________________________
dba-VB mailing list
dba-VB at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-vb
http://www.databaseadvisors.com




More information about the dba-VB mailing list