|
-
Jan 23rd, 2005, 07:58 AM
#1
Thread Starter
Addicted Member
Internet connected?
How can I detect if the computer is connected to internet (also please mention if I need any components)?
"Quis custodiet ipsos custodes?"
Juvenal
Mete the Hun wanted to live in peace with the Chinese. So he gave the Chinese Emperor his favorite horse, best swords in his armory, and lots of other cool stuff. But then the Chinese Emperor asked for one thing. A useless land through the north. It was a small, useless, unproductive, uninhabited piece of land. But Mete the Hun's answer was certain:
I gave you horses, weapons and much more which belonged to me. But the lands are not mine, it's my nation's and I'm ready to fight, kill and die for just an inch my country
-=Joey Jordison R0CKS!! =-
-
Jan 23rd, 2005, 08:36 AM
#2
Re: Internet connected?
you could just send a ping to your dns server
rgds pete
-
Jan 23rd, 2005, 08:40 AM
#3
Thread Starter
Addicted Member
"Quis custodiet ipsos custodes?"
Juvenal
Mete the Hun wanted to live in peace with the Chinese. So he gave the Chinese Emperor his favorite horse, best swords in his armory, and lots of other cool stuff. But then the Chinese Emperor asked for one thing. A useless land through the north. It was a small, useless, unproductive, uninhabited piece of land. But Mete the Hun's answer was certain:
I gave you horses, weapons and much more which belonged to me. But the lands are not mine, it's my nation's and I'm ready to fight, kill and die for just an inch my country
-=Joey Jordison R0CKS!! =-
-
Jan 23rd, 2005, 08:41 AM
#4
Re: Internet connected?
Yep...
wouldn't something along the lines of
Shell "ping www.google.com"
work ?
-
Jan 23rd, 2005, 08:42 AM
#5
Thread Starter
Addicted Member
Re: Internet connected?
k but how can i check the results of ping?
"Quis custodiet ipsos custodes?"
Juvenal
Mete the Hun wanted to live in peace with the Chinese. So he gave the Chinese Emperor his favorite horse, best swords in his armory, and lots of other cool stuff. But then the Chinese Emperor asked for one thing. A useless land through the north. It was a small, useless, unproductive, uninhabited piece of land. But Mete the Hun's answer was certain:
I gave you horses, weapons and much more which belonged to me. But the lands are not mine, it's my nation's and I'm ready to fight, kill and die for just an inch my country
-=Joey Jordison R0CKS!! =-
-
Jan 23rd, 2005, 08:44 AM
#6
Re: Internet connected?
To tell you the truth i diodn't think of that... damnit, no point if you can't check it... lol
Erm, wait til the other guy gets back in here, he should know
-
Jan 23rd, 2005, 08:46 AM
#7
Thread Starter
Addicted Member
Re: Internet connected?
yep.. nice sig by the way
"Quis custodiet ipsos custodes?"
Juvenal
Mete the Hun wanted to live in peace with the Chinese. So he gave the Chinese Emperor his favorite horse, best swords in his armory, and lots of other cool stuff. But then the Chinese Emperor asked for one thing. A useless land through the north. It was a small, useless, unproductive, uninhabited piece of land. But Mete the Hun's answer was certain:
I gave you horses, weapons and much more which belonged to me. But the lands are not mine, it's my nation's and I'm ready to fight, kill and die for just an inch my country
-=Joey Jordison R0CKS!! =-
-
Jan 23rd, 2005, 08:47 AM
#8
Re: Internet connected?
 Originally Posted by kill_bill_gates
yep.. nice sig by the way
lol, ty
I wonder if this has been asked B4 u kno, i'm, sure it has, do a search there should be a few examples...
-
Jan 23rd, 2005, 08:50 AM
#9
Fanatic Member
Re: Internet connected?
There's massive threads about this. Many ways to do it. The problem is, some of the methods initiate a connection attempt, which maybe unwanted. On the other hand, if you don't want to initiate a connection attempt, then you must use tons of code (that have already been composed by other people) that will check to see if there is an internet connection Cable/DSL/Dial up.
Visual Basic 6.0
Visual C++ 5
Delphi 5

-
Jan 23rd, 2005, 08:55 AM
#10
Lively Member
Re: Internet connected?
Ping, write the results to text file, then phase through flie for results.
VB Code:
Shell "cmd /k ping google.com >c:\ping_test.txt ", vbHide
Its in the forum somwhere, thats where i got the code above form.
_
~ What was once an opinion, became a fact, to be later proven wrong... ~
-
Jan 23rd, 2005, 08:58 AM
#11
Thread Starter
Addicted Member
"Quis custodiet ipsos custodes?"
Juvenal
Mete the Hun wanted to live in peace with the Chinese. So he gave the Chinese Emperor his favorite horse, best swords in his armory, and lots of other cool stuff. But then the Chinese Emperor asked for one thing. A useless land through the north. It was a small, useless, unproductive, uninhabited piece of land. But Mete the Hun's answer was certain:
I gave you horses, weapons and much more which belonged to me. But the lands are not mine, it's my nation's and I'm ready to fight, kill and die for just an inch my country
-=Joey Jordison R0CKS!! =-
-
Jan 23rd, 2005, 09:01 AM
#12
Lively Member
~ What was once an opinion, became a fact, to be later proven wrong... ~
-
Jan 23rd, 2005, 09:32 AM
#13
Re: Internet connected?
 Originally Posted by kill_bill_gates
How can I detect if the computer is connected to internet (also please mention if I need any components)?
You need to use some api to get the state of your current connection. There are few different approches that could be used so here is the simplest one:
VB Code:
Private Const INTERNET_CONNECTION_CONFIGURED = &H40
Private Const INTERNET_CONNECTION_LAN = &H2
Private Const INTERNET_CONNECTION_MODEM = &H1
Private Const INTERNET_CONNECTION_OFFLINE = &H20
Private Const INTERNET_CONNECTION_PROXY = &H4
Private Const INTERNET_RAS_INSTALLED = &H10
Private Declare Function InternetGetConnectedState Lib "wininet.dll" (ByRef lpdwFlags As Long, ByVal dwReserved As Long) As Long
Private Sub Form_Load()
'KPD-Team 2001
'URL: [url]http://www.allapi.net/[/url]
Dim Ret As Long
Me.AutoRedraw = True
'retrieve the connection status
InternetGetConnectedState Ret, 0&
'show the result
If (Ret And INTERNET_CONNECTION_CONFIGURED) = INTERNET_CONNECTION_CONFIGURED Then Me.Print "Local system has a valid connection to the Internet, but it may or may not be currently connected."
If (Ret And INTERNET_CONNECTION_LAN) = INTERNET_CONNECTION_LAN Then Me.Print "Local system uses a local area network to connect to the Internet."
If (Ret And INTERNET_CONNECTION_MODEM) = INTERNET_CONNECTION_MODEM Then Me.Print "Local system uses a modem to connect to the Internet."
If (Ret And INTERNET_CONNECTION_OFFLINE) = INTERNET_CONNECTION_OFFLINE Then Me.Print "Local system is in offline mode."
If (Ret And INTERNET_CONNECTION_PROXY) = INTERNET_CONNECTION_PROXY Then Me.Print "Local system uses a proxy server to connect to the Internet."
If (Ret And INTERNET_RAS_INSTALLED) = INTERNET_RAS_INSTALLED Then Me.Print "Local system has RAS installed."
End Sub
-
Jan 23rd, 2005, 09:38 AM
#14
Thread Starter
Addicted Member
"Quis custodiet ipsos custodes?"
Juvenal
Mete the Hun wanted to live in peace with the Chinese. So he gave the Chinese Emperor his favorite horse, best swords in his armory, and lots of other cool stuff. But then the Chinese Emperor asked for one thing. A useless land through the north. It was a small, useless, unproductive, uninhabited piece of land. But Mete the Hun's answer was certain:
I gave you horses, weapons and much more which belonged to me. But the lands are not mine, it's my nation's and I'm ready to fight, kill and die for just an inch my country
-=Joey Jordison R0CKS!! =-
-
Jan 23rd, 2005, 09:39 AM
#15
Re: Internet connected?
No problem.
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
|