Search Tools Links Login

Check if user is Online


Visual Basic 6, or VB Classic

The code checks if the User is online or not. If he's online it will prompt a MsgBox "You are connected to the net.") or it will Show: "You are NOT connected to the net.". You can also insert your code. This code is useful when your application uses the internet. So if the user is not connected the net, the program will simply unload.

Original Author: Hasenmann

Code

Private Type RASCONN
  dwSize As Long
  hRasConn As Long
  szEntryName(256) As Byte
  szDeviceType(16) As Byte
  szDeviceName(128) As Byte
End Type
Private Declare Function RasEnumConnectionsA& Lib "RasApi32.DLL" (lprasconn As Any, lpcb&, lpcConnections&)
Private Sub Command1_Click()
Dim Verbindung As RASCONN
Dim size, Anz As Long
Verbindung.dwSize = 412
size = Verbindung.dwSize
If RasEnumConnectionsA(Verbindung, size, Anz) = 0 Then
  If Anz = 0 Then
  MsgBox ("You are NOT connected to the net.")
  Else
  MsgBox ("You are connected to the net.")
  End If
End If
End Sub

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 95 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.