Search Tools Links Login

Detecting if connected to LAN or WAN


One line of code will tell you if you are connected to LAN or WAN(Internet).

Original Author: Khursheed_Siddiqui

Code

Private Declare Function IsNetworkAlive Lib "Sensapi.dll" (LPDFlags As Long) As Long

Private Const NETWORK_ALIVE_LAN = &H1 'net card connection

Private Const NETWORK_ALIVE_WAN = &H2 'RAS connection

Private Const NETWORK_ALIVE_AOL = &H4 'AOL

Private Sub Form_Load()

Dim tmp As Long

Dim ConnectionType As String


If IsNetworkAlive(tmp) = NETWORK_ALIVE_LAN Then

ConnectionType = "LAN"

ElseIf IsNetworkAlive(tmp) = NETWORK_ALIVE_WAN Then

ConnectionType = "WAN"

ElseIf IsNetworkAlive(tmp) = NETWORK_ALIVE_AOL Then

ConnectionType = "AOL"

Else

ConnectionType = "Could not Determine."

End If

Print

Print "Your connection type is: " & ConnectionType



End Sub

About this post

Posted: 2003-06-01
By: ArchiveBot
Viewed: 129 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.