これを使用して、VB6のmCoreActiveXコンポーネントを使用してSMSを送信しています。このコードは正常に機能していますが、1つのSMSを複数回送信することがあります(実際、アプリケーションを閉じるまでに数百回)。私はVB6に精通しているので、私を案内してください
Public Function SendSMS()
On Error Resume Next
Dim strSendResult As String
Dim ij As Integer
Dim message As String
Dim blnAllMsgsSent As Boolean
Dim message1
Dim id As Integer
blnAllMsgsSent = True
If objSMS.Connect Then
Timer2.Enabled = False
ij = 0
Sql = "SELECT id,message,MobileNo FROM tblSendSMS where status='Pending' order by id asc;"
RS.Open Sql, Conn, adOpenDynamic
If Not RS.EOF Then
RS.MoveFirst
Do While Not RS.EOF
message = RS!message
If RS!message <> "" Then
id = RS!id
'' send message now
strSendResult = objSMS.SendSMS(MobileNo, message)
strSendResult = ""
If objSMS.IsError(True, "Application.exe") Then
blnAllMsgsSent = False
End If
End If
If blnAllMsgsSent Then
Sql = "update tblSendSMS set status='Sent' where id=" & id
Conn.Execute Sql
End If
ij = ij + 1
RS.MoveNext
Loop
End If
RS.Close
Else
SetCommParameters
End If
Timer2.Enabled = True
End Function