hey guys i need the program to check whether the computer is connected to internet or not
with the warning message "not connected' if not connected
PLz help me fast
Printable View
hey guys i need the program to check whether the computer is connected to internet or not
with the warning message "not connected' if not connected
PLz help me fast
You could try pinging the local computer's default gateway, and then ping the local ISP's dns servers. If you can ping the DNS servers, chances are you're connected.
You can check if you're on the local network by using this code:
You can use the methods in My.Computer.Network to figure out if you're connected or notCode:My.Computer.Network.IsAvailable()
Common guys help me out
i know how to check whther the computer is connected net or not
but i need to know how to make exe to check the computer is connected to internet or not
you should use Winsock, but here is an API version
VB Code:
Option Explicit Private Const FLAG_ICC_FORCE_CONNECTION = &H1 Private Declare Function InternetCheckConnection Lib "wininet.dll" Alias "InternetCheckConnectionA" _ (ByVal lpszUrl As String, ByVal dwFlags As Long, ByVal dwReserved As Long) As Long Private Const sURL As String = "http://www.mytesturl.com" Private Function CheckInternet() As Boolean If InternetCheckConnection(sURL, FLAG_ICC_FORCE_CONNECTION, 0&) Then CheckInternet = True End If End Function Private Sub Command1_Click() MsgBox CheckInternet End Sub
frens thanks for all of u for sending me the solutions
happy frenship week :wave: :thumb: :eek2:
no prob, remember to change the URL to a valid one so it works..
Tip, if you were to use Winsock, then use the Winsock Error and Connect Events to set a Boolean, it will not hang like the API does temporarily when it cant connect .. but it will require more code.