Connected to the net?

I searched alot for an answer to this question but no luck.
I want to know if I am connected to the internet or not, I may be connected from another computer (lan).

Some of the answer they gave me:
-Ping website
its not good since my program is going to check for internet connection every sec, and using batch wont be good then
-API --> GetConnectionStat / InternetConnectionEx / IsConnected
all these are telling me that I am connected to the net when I am only connected to the network

I got many other answers but the codes wount be able to tell me that I am connected to the net when I am recieving connection from another PC
can u help?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Try creating a new Web Browser form. Set its MDIChild property to False.
On Form1 create one command button and one timer.
Paste this code:
Private Sub Command1_Click()
    frmBrowser.cboAddress.AddItem ""
    frmBrowser.cboAddress.ListIndex = 0
    Timer1.Interval = 1000
    Timer1.Tag = 1
    Timer1.Enabled = True
End Sub

Private Sub Form_Load()
    Load frmBrowser
End Sub

Private Sub Timer1_Timer()
    Timer1.Tag = Timer1.Tag + 1
    If Timer1.Tag = 60 Then
        Form1.Caption = "Not connected ... try again later"
        Timer1.Enabled = False
        Exit Sub
    End If
    Form1.Caption = "Waiting..."
    If frmBrowser.Caption = "Google" Then
        Form1.Caption = "Connected"
        Timer1.Enabled = False
    End If
End Sub
Each time you click a button, request for openning google page will be sent.
Timer will then check every second if frmBrowsers caption was changed.
If it doesn't change to "Google" in 60 seconds, then you are probably not connected.   ( I think 60 sec should be more than enough to load google )

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
instant_newAuthor Commented:
well that worked, but there must be a better way, without using a Web Browser Form...
I'll wait for new replies if not u will get points

it is always saying Reachable >> No
it isnt working, although it would be great if it worked.
Maximize Customer Retention with Superior Service

The IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more to help build customer satisfaction and retention.

Try this

Option Explicit

Private Type QOCINFO
    dwSize As Long
    dwFlags As Long
    dwInSpeed As Long 'in bytes/second
    dwOutSpeed As Long 'in bytes/second
End Type
Private Declare Function IsDestinationReachable Lib "SENSAPI.DLL" Alias "IsDestinationReachableA" (ByVal lpszDestination As String, ByRef lpQOCInfo As QOCINFO) As Long
Private Sub Form_Load()
    'KPD-Team 2001
    Dim Ret As QOCINFO
    Ret.dwSize = Len(Ret)
    If IsDestinationReachable("", Ret) = 0 Then
        MsgBox "The destination cannot be reached!"
        MsgBox "The destination can be reached!" + vbCrLf + _
           "The speed of data coming in from the destination is " + Format$(Ret.dwInSpeed / 1024, "#.0") + " Kb/s," + vbCrLf + _
           "and the speed of data sent to the destination is " + Format$(Ret.dwOutSpeed / 1024, "#.0") + " Kb/s."
    End If
End Sub

I agree that there must be a better way.
Take my example just as a backup sollution if nothing else works.
In the meanwhile, I would suggest you to stick with EDDYKT. He might be on the right track.

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Split dbrckovi, EDDYKT
Please leave any comments here within the next seven days.


EE Cleanup Volunteer
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.