Connection
April 9, 2008
Dim blnConnected As Boolean
Private Sub cmdConn_Click()
wsPop.Close
Do
DoEvents
Loop While wsPop.State <> sckClosed
wsPop.Connect txtserver.Text, txtport.Text
End Sub
Private Sub cmdSend_Click()
wsPop.SendData txtsend & vbCrLf
txtsend.SetFocus
End Sub
Private Sub Form_Load()
End Sub
Private Sub mnuClose_Click()
End
End Sub
Private Sub wsPop_Connect()
blnConnected = True
txtsend.Enabled = True
cmdSend.Enabled = True
txtReceived.Text = “Terkoneksi ke” & wsPop.RemoteHost
End Sub
Private Sub wsPop_DataArrival(ByVal bytesTotal As Long)
Dim strdata As String
wsPop.GetData strdata
txtReceived.Text = txtReceived.Text & vbNewLine & strdata
End Sub
Internet DialUp
April 9, 2008
Private Declare Function InternetAutodial Lib “wininet.dll” (ByVal dwFlags As Long, ByVal dwReserved As Long) As Long
Private Const INTERNET_AUTODIAL_FORCE_ONLINE = 1
Private Const INTERNET_AUTODIAL_FORCE_UNATTENDED = 2
Private Declare Function InternetAutodialHangup Lib “wininet.dll” (ByVal dwReserved As Long) As Long
Private Sub Command1_Click()
‘ To prompt the user to connect to the Net
If InternetAutodial(INTERNET_AUTODIAL_FORCE_ONLINE, 0) Then
MsgBox “You’re Connected!”, vbInformation
End If
‘ To automatically start dialling
If InternetAutodial(INTERNET_AUTODIAL_FORCE_UNATTENDED, 0) Then
MsgBox “You’re Connected!”, vbInformation
End If
‘ To disconnect an automatically dialled connection
If InternetAutodialHangup(0) Then
MsgBox “You’re Disconnected!”, vbInformation
End If
End Sub