Sunday, July 22, 2012

VB6 SMS Gateway: AT Command Tester Sederhana

Option Explicit 

Dim strBuffer As String 

Private Sub cmdSend_Click()
    txtResult.Text = ""
    txtProcess.Text = ""
    strBuffer = ""
    If UCase$(Left$(txtATCommand.Text, 2)) <> "AT" Then
        MSComm1.Output = txtATCommand.Text & Chr(26)
    Else
        MSComm1.Output = txtATCommand.Text & vbCrLf
    End If
End Sub

Private Sub Form_Load()
    If MSComm1.PortOpen = True Then MSComm1.PortOpen = False
    With MSComm1
        .CommPort = 7
        .Settings = "115200,N,8,1"
        .Handshaking = comRTS
        .RTSEnable = True
        .DTREnable = True
        .RThreshold = 1
        .SThreshold = 1
        .InputMode = comInputModeText
        .InputLen = 0
        .PortOpen = True
    End With
End Sub

Private Sub Form_Unload(Cancel As Integer)
    If MSComm1.PortOpen = True Then
        MSComm1.PortOpen = False
    End If
End Sub

Private Sub MSComm1_OnComm()
    Select Case MSComm1.CommEvent
        Case comEvReceive
            strBuffer = strBuffer & MSComm1.Input
    End Select
    txtProcess.Text = strBuffer
    txtProcess.SelStart = Len(txtProcess.Text)
    Do
        strBuffer = strBuffer & MSComm1.Input
    Loop While MSComm1.InBufferCount
    If InStr(1, strBuffer, "OK") > 0 Then
        txtResult.Text = strBuffer
        txtResult.SelStart = Len(txtResult.Text)
    ElseIf InStr(1, strBuffer, "ERROR") Then
        txtResult.Text = strBuffer
        strBuffer = ""
    End If
End Sub
 
Source : http://vb6-sourcecode-insert.blogspot.com/


HOT INFO

Anda ingin mencari refrensi dan contoh program lengkap ? Kami ada. Sekarang Anda bisa mencari Source Code SMS Gateway di situs ini : www.panduanSkripsi.net. Koleksi program lengkap di sana, proyek PHP dan MySQL, juga jQuery dan Framework. Bukunya juga ada.

1 comment:

  1. AT-Command itu hardware atau hanya ocx aja, mas/mbak?
    kalau hardware, bentuknya seperti apa dan membelinya dimana??
    terima kasih sebelumnya

    ReplyDelete