Results 1 to 3 of 3

Thread: Internet Connectivity

Hybrid View

  1. #1

    Thread Starter
    Junior Member RingOfFire's Avatar
    Join Date
    May 2006
    Location
    Istanbul
    Posts
    28

    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:
    1. Private Declare Function InternetGetConnectedState Lib "wininet" _
    2.         (ByRef dwFlags As Long, ByVal dwReserved As Long) As Long
    3.  
    4.     'Define possible connection types
    5.     Private Enum ConnectStates
    6.         LAN = &H2
    7.         Modem = &H1
    8.         Proxy = &H4
    9.         Offline = &H20
    10.         Configured = &H40
    11.         RasInstalled = &H10
    12.     End Enum
    13.  
    14.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    15.         Dim lng_dwFlags As Long
    16.         Dim blnConnected As Boolean = (InternetGetConnectedState(lng_dwFlags, 0&) <> 0)
    17.         Dim strMessage As String
    18.         Dim ConnectionType As ConnectStates
    19.  
    20.         If blnConnected Then
    21.             strMessage += "Computer is Connected" & ControlChars.NewLine
    22.  
    23.             'Display the connection flags
    24.             strMessage += "Connection Flags: " & ControlChars.NewLine
    25.             For Each connectiontype In _
    26.                 System.Enum.GetValues(GetType(ConnectStates))
    27.                 If (ConnectionType And lng_dwFlags) = ConnectionType Then
    28.                     strMessage += "     " & ConnectionType.ToString() & ControlChars.NewLine
    29.                 End If
    30.             Next
    31.         End If
    32.  
    33.         MessageBox.Show(strMessage)
    34.     End Sub
    Code from: http://www.timkey.net/Community/dotnet/260.aspx

    Thanks a lot for your help!

  2. #2
    Frenzied Member MrGTI's Avatar
    Join Date
    Oct 2000
    Location
    Ontario, Canada
    Posts
    1,277

    Question Re: Internet Connectivity

    What is your question? What problem are you having?
    ~Peter


  3. #3

    Thread Starter
    Junior Member RingOfFire's Avatar
    Join Date
    May 2006
    Location
    Istanbul
    Posts
    28

    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
  •  



Click Here to Expand Forum to Full Width