|
-
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!
-
Jun 13th, 2006, 12:07 PM
#2
Frenzied Member
-
Jun 14th, 2006, 01:47 AM
#3
Thread Starter
Junior Member
Re: Internet Connectivity
Sorry if I was not clear...
I'd like to know how to include, to my existing VB.NET application, the following feature:
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.
So this was my primary question: Creating an "Silent Update Checker" for a VB.NET app.
I've mentioned 2 features in my first post but found the solution to my first request from the net and I wanted to share it with others... But if there is a better code, I'm open.
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
|