Hai Saya kembali lagi, kali ini saya akan share ilmu gimana cara chek koneksi internet dengan menggunakan visual basic clasic 5 - 6
Baiklah Langsung saja Siapkan :
- Buka Visual Basic
- Select Standart Exe
- Buat 1 Form
- Buat 1 Button
- Buat 1 Module
Itu Saja Yang kita butuhkan mari kita masuk ke codenya :
Masukan Kode Berikut Ke Button Yang Telah Anda Buat Tadi :
If Cek_Konek = True Then
MsgBox "Komputer Anda Terkoneksi Inernet!!", vbInformation, "VickHamShare"
Else
MsgBox "Maf Anda Tidak Terkoneksi Dengan Internet!!", vbExclamation, "VickHamShare"
End If
Kemudian masukan kode berikut ke form load, cara cepat klik saja formnya dua kali :
If Cek_Konek = False Then
Me.Caption = "Not-Connect"
Else
Me.Caption = "Connect"
End If
Kemudian Masukan Kode Berikut Ke Module Yang Telah Anda Buat Tadi :
Public Declare Function RasEnumConnections Lib "RasApi32.dll" Alias "RasEnumConnectionsA" (lpRasCon As Any, lpcb As Long, lpcConnections As Long) As Long
Public Declare Function RasGetConnectStatus Lib "RasApi32.dll" Alias "RasGetConnectStatusA" (ByVal hRasCon As Long, lpStatus As Any) As Long
Public Const RAS95_MaxEntryName = 256
Public Const RAS95_MaxDeviceType = 16
Public Const RAS95_MaxDeviceName = 32
Public Type RASCONN95
dwSize As Long
hRasCon As Long
szEntryName(RAS95_MaxEntryName) As Byte
szDeviceType(RAS95_MaxDeviceType) As Byte
szDeviceName(RAS95_MaxDeviceName) As Byte
End Type
Public Type RASCONNSTATUS95
dwSize As Long
RasConnState As Long
dwError As Long
szDeviceType(RAS95_MaxDeviceType) As Byte
szDeviceName(RAS95_MaxDeviceName) As Byte
End Type
Public Function Cek_Konek() As Boolean
Dim TRasCon(255) As RASCONN95
Dim lg As Long
Dim lpcon As Long
Dim RetVal As Long
Dim Tstatus As RASCONNSTATUS95
TRasCon(0).dwSize = 412
lg = 256 * TRasCon(0).dwSize
RetVal = RasEnumConnections(TRasCon(0), lg, lpcon)
If RetVal <> 0 Then
MsgBox "ERROR"
Exit Function
End If
Tstatus.dwSize = 160
RetVal = RasGetConnectStatus(TRasCon(0).hRasCon, Tstatus)
If Tstatus.RasConnState = &H2000 Then
Cek_Konek = True
Else
Cek_Konek = False
End If
End Function
Hasil Dari Check Koneksi Internet :
Download Source Codenya Via VickHamShare :
Home »
Check Koneksi Internet
,
Download Source Code
,
Sc Visual Basic
,
Source Code
,
Source Code 2013
,
Vb
,
Visual Basic
» Cara Check Koneksi Internet In Vb Classic
Cara Check Koneksi Internet In Vb Classic
Posted by Vicky Hamonangan - VickHamShare
Posted on 11.18
with No comments
0 komentar:
Posting Komentar