Computer Online?
Computer Online?
Computer Online?
Computer Online?
Computer Online?
Computer Online? Computer Online? Computer Online? Computer Online? Computer Online? Computer Online? Computer Online? Computer Online?
Computer Online? Computer Online?
Computer Online?
Go Back  Xtreme Visual Basic Talk > > > Computer Online?


Reply
 
Thread Tools Display Modes
  #1  
Old 05-21-2005, 09:10 AM
br00n br00n is offline
Newcomer
 
Join Date: Jul 2004
Posts: 24
Default Computer Online?


I'm trying to find som code which will tell the user if the other LAN computer is online ... for example :

If "BrotherComputer" = Online Then
MsgBox "Other computer is online"
Else
MsgBox "The other computer is currently offline"
End If


Thanks for your help!
Reply With Quote
  #2  
Old 05-22-2005, 10:32 AM
Greeg Greeg is offline
Regular
 
Join Date: Aug 2003
Location: Liverpool
Posts: 51
Default

some pretty simple code i found should work

Code:
Option Explicit Private Declare Function GetRTTAndHopCount Lib "iphlpapi.dll" _ (ByVal lDestIPAddr As Long, _ ByRef lHopCount As Long, _ ByVal lMaxHops As Long, _ ByRef lRTT As Long) As Long Private Declare Function inet_addr Lib "wsock32.dll" _ (ByVal cp As String) As Long Public Function SimplePing(sIPadr As String) As Boolean Dim lIPadr As Long Dim lHopsCount As Long Dim lRTT As Long Dim lMaxHops As Long Dim lResult As Long Const SUCCESS = 1 lMaxHops = 20 ' should be enough ... lIPadr = inet_addr(sIPadr) SimplePing = (GetRTTAndHopCount(lIPadr, lHopsCount, lMaxHops, lRTT) = SUCCESS) End Function Private Sub cmdCheck_Click() If SimplePing("192.168.2.1") = True Then MsgBox "online" Else MsgBox "offline" End If End Sub

you should be able to lower the lMaxHops number since its over a LAN
Reply With Quote
  #3  
Old 05-22-2005, 01:29 PM
br00n br00n is offline
Newcomer
 
Join Date: Jul 2004
Posts: 24
Default

Thank you for your help Greeg, that seems to be working
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Computer Online?
Computer Online?
Computer Online? Computer Online?
Computer Online?
Computer Online?
Computer Online? Computer Online? Computer Online? Computer Online? Computer Online? Computer Online? Computer Online?
Computer Online?
Computer Online?
 
Computer Online?
Computer Online?
 
-->