|
-
Jun 13th, 2006, 07:39 AM
#1
Thread Starter
Junior Member
Internet Connectivity
Hello all,
I want to implement to my application the following features:
1. Internet Connectivity Checker.
2. Online Updates Controller.
Checks at the background -silently- each time the application is loaded, for existance of a specific file (let's name it as: update.xml) on the server (eg. myserver.com/updates). If there is no update, nothing is done (no popups, no message boxes...nada..) but if there is the update.xml file, user is informed with a simple text on StatusBar ("There is an update available"). That's all.
I've already found the code for Internet connectivity, here it is:
VB Code:
Private Declare Function InternetGetConnectedState Lib "wininet" _
(ByRef dwFlags As Long, ByVal dwReserved As Long) As Long
'Define possible connection types
Private Enum ConnectStates
LAN = &H2
Modem = &H1
Proxy = &H4
Offline = &H20
Configured = &H40
RasInstalled = &H10
End Enum
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim lng_dwFlags As Long
Dim blnConnected As Boolean = (InternetGetConnectedState(lng_dwFlags, 0&) <> 0)
Dim strMessage As String
Dim ConnectionType As ConnectStates
If blnConnected Then
strMessage += "Computer is Connected" & ControlChars.NewLine
'Display the connection flags
strMessage += "Connection Flags: " & ControlChars.NewLine
For Each connectiontype In _
System.Enum.GetValues(GetType(ConnectStates))
If (ConnectionType And lng_dwFlags) = ConnectionType Then
strMessage += " " & ConnectionType.ToString() & ControlChars.NewLine
End If
Next
End If
MessageBox.Show(strMessage)
End Sub
Code from: http://www.timkey.net/Community/dotnet/260.aspx 
Thanks a lot for your help!
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
|