|
-
Aug 31st, 2000, 12:35 PM
#1
Thread Starter
Hyperactive Member
I am using the following declarations:
Private Declare Function InternetAutodial Lib "wininet.dll" (ByVal dwFlags As Long, ByVal dwReserved As Long) As Long
Private Const INTERNET_AUTODIAL_FORCE_ONLINE = 1
Private Const INTERNET_AUTODIAL_FORCE_UNATTENDED = 2
Private Declare Function InternetAutodialHangup Lib "wininet.dll" (ByVal dwReserved As Long) As Long
Private Declare Function InternetGetConnectedState Lib "wininet.dll" (ByRef lpSFlags As Long, ByVal dwReserved As Long) As Long
The current computer is connected to internet via LAN.
InternetGetConnectedState(0&, 0&) will then return '1'
If I unplug the RJ-45,
InternetGetConnectedState(0&, 0&) will still return '1'
If I let the RJ-45 unplugged and reboot the machine,
InternetGetConnectedState(0&, 0&) will then correctly return '0'
Read the topic, that's what I need. Is there a more efficient way than the one I'm trying to use?
Thanks for any feedback.
(I know that many threads were written about internet connectivity, but they just seem to have lost me)
-
Aug 31st, 2000, 12:47 PM
#2
Member
I'm kind of a newbie but,
I never really had to check to see if there was an internet connection, i just call winsock and it will logon if the computer isn't or do whatever internet tasks you wanted if the computer is.
I realize this is very basic, however, so I'd like to see the answer to your question too.
There's a snippet from vb-helper i downloaded a while ago that is supposed to check the modem to see if there is a connection, if you want, i'll send you the zip.
-
Aug 31st, 2000, 12:52 PM
#3
_______
<?>
there is a new twist to look for as well..I had code for checking and it worked on my modem but now I have DSL and it says I am not connected to the internet...Just discovered that cause I was going to post the code but no need..it doesn't cover all the bases.
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Aug 31st, 2000, 12:59 PM
#4
_______
<?>
Mathew..your first code doesn't find my DSL connection
and there is something wrong in your type declarations in your second set of code.
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Aug 31st, 2000, 01:10 PM
#5
Fanatic Member
A different approach to this problem
I'm one of those whose asked about this same topic in the past. Since there doesn't seem to be an all-inclusive solution (that I've seen at least ) then, maybe this technique can be attempted.
Maybe your program can attempt to navigate to a certain webpage. If an error is returned (meaning the page isn't available because you're offline), then you know you're not connected. If the page is displayed without any errors, then you know that you are connected.
I know that this is a simple solution, but sometimes simple solutions work best! Also, this basic logic could probably be adapted to all the ways that are available to connect to the Internet.
All the best.
-
Aug 31st, 2000, 01:27 PM
#6
I used the code I posted above and it worked fine for me.
But since it was useless and not needed, I deleted it.
I came up with another way though, why not ping your IP to see if you get a response? If you get a response, your connected.
Take a look at this thread for an example on how to ping an IP address. The 0's are messed up, so email me if you would like it emailed to you.
-
Aug 31st, 2000, 04:55 PM
#7
_______
<?>
FYI
More of the same stuff:
I found this but haven't checked it out yet.http://www.freevbcode.com/ShowCode.Asp?ID=632
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|