Bu kod sayesinde İnternet'e bağlı olup olmadığımız öğrenilir.
Bu kod sayesinde İnternet'e bağlı olup olmadığımız öğrenilir.

Option Explicit
Private Declare Function RasEnumConnections Lib "RasApi32.dll" _
Alias "RasEnumConnectionsA" (lpRasCon As Any, lpcb As _
Long, lpcConnections As Long] As Long
Private Declare Function RasGetConnectStatus Lib "RasApi32.dll" _
Alias "RasGetConnectStatusA" (ByVal hRasCon As Long, _
lpStatus As Any] As Long
Const RAS_MaxEntryName = 256
Const RAS_MaxDeviceType = 16
Const RAS_MaxDeviceName = 32
Private Type RASType
dwSize As Long
hRasCon As Long
szEntryName(RAS_MaxEntryName] As Byte
szDeviceType(RAS_MaxDeviceType] As Byte
szDeviceName(RAS_MaxDeviceName] As Byte
End Type
Private Type RASStatusType
dwSize As Long
RasConnState As Long
dwError As Long
szDeviceType(RAS_MaxDeviceType] As Byte
szDeviceName(RAS_MaxDeviceName] As Byte
End Type
Private Sub Form_Load(]
Timer1.Interval = 200
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer(]
DFÜStatus
End Sub
Private Function DFÜStatus(] As Boolean
Dim RAS(255] As RASType, RASStatus As RASStatusType
Dim lg&, lpcon&, Result&
RAS(0].dwSize = 412
lg = 256 * RAS(0].dwSize
Result = RasEnumConnections(RAS(0], lg, lpcon]
If lpcon = 0 Then
Label1.Caption = "Offline" '###
DFÜStatus = False
Else
RASStatus.dwSize = 160
Result = RasGetConnectStatus(RAS(0].hRasCon, RASStatus]
If RASStatus.RasConnState = &H2000 Then
Label1.Caption = "Online" '###
DFÜStatus = True
Else
Label1.Caption = "Baglanti Kopuk" '###
DFÜStatus = False
End If
End If
End Function 


Batuhan Pol

Batuhan P.

12'li yaşlarda tanıştığım bu sektöre şuanla beraber olmak üzere 10 yıldır sürdürmekteyim. Küçük yaşlarda milyonların girdiği projeler yapsamda çocukluk aklım ve imkanlar dolayısıyla erken biten maceralar oldu. Şimdi ise yerlerinde başkaların yaptığı projeler var. Yoksa bende milyoner olurdum heralde :)

Post A Comment:

0 comments: