Snippet Source Code Module Keypad Software Server Pulsa
Bagi Anda seorang NewBie didunia HP Programming, khususnya yang mencoba berkutat didalam pembuatan software Isi Pulsa, mungkin snippet code (VB) berikut berguna untuk Anda.
Dim Data As String
Private Declare Function GetTickCount Lib “kernel32″ () As Long
Private Sub Delay(milliseconds As Long)
On Error GoTo hell
Dim initTime As Long
Dim FinTime As Long
initTime = GetTickCount
Do
FinTime = GetTickCount
DoEvents
Loop Until FinTime >= initTime + milliseconds
Exit Sub
hell:
MsgBox “Error Number : ” & Err.Number & Chr(13) & “Error Description : ” & Err.Description, vbInformation, “Delay”
End Sub
Private Sub cmdSend_Click()
Text1.Text = “12345678901234567890″
Data = “”
For I = 1 To Len(Text1.Text)
COM.Output = “AT+CKPD=” + Mid(Text1.Text, I, 1) + Chr(13)
Do
Delay (30)
DoEvents
Data = Data & COM.Input
Loop Until InStr(Data, “OK”) Or InStr(Data, “ERROR”)
Delay (300)
Next
End Sub
Sumber : Forum Vb-Bego



