Answered by:
VB 6 - AT Commands (SMS)

Question
-
Hi,
I have never used VB6 thus haven't used such an old structure.
While a similar project in VB.Net works good I can't find a similar code in VB6. Need to use AT-Commands to send SMS via a by a form containing simple button. but can't find the ports available in ComboBox, thus tried 1 to 10 options via loop and On Error Resume Next option but no luck.
Simple form code like:
Private Sub Command1_Click()
Dim mscomm1 As New MSComm, Cntr As Integer
On Error Resume Next
For Cntr = 1 To 6
MsgBox Cntr & " - " & """03009270563"""
mscomm1.CommPort = Cntr
mscomm1.Settings = "9600,N,8,1"
mscomm1.InputLen = 0
If mscomm1.PortOpen = True Then mscomm1.PortOpen = False
mscomm1.PortOpen = True
mscomm1.Output = "AT"
mscomm1.Output = "AT+CMGF=1"
mscomm1.Output = "AT+CMGS=" & """03009270563""" ' & Chr$(34) & "+923009270563" & Chr$(34) & Chr(13) & Chr(10)
mscomm1.Output = "This is a testing message from VB 6.0 via Port # " & Cntr & vbCrLf & Chr(26)
Next
mscomm1.PortOpen = False
Unload Me
End Sub
Please see if one of you experts can help in this regard.
Thanks in advance.
- Moved by KareninstructorMVP Thursday, August 11, 2016 11:18 PM Moved from VB.NET
Thursday, August 11, 2016 9:00 PM
Answers
-
Need to use AT-Commands to send SMS via a by a form containing simple button. but can't find the ports available in ComboBox
This question is already answered many times at the proper place. For instance:
http://www.vbforums.com/showthread.php?330061-Get-list-of-available-comm-port- Proposed as answer by Cor Ligthert Thursday, August 11, 2016 10:27 PM
- Marked as answer by Faraz A. Qureshi Saturday, November 19, 2016 3:20 PM
Thursday, August 11, 2016 10:17 PM
All replies
-
If you need help with a VB6 application, then you should be asking on a forum that is for VB6, not a forum for VB.Net.
If you say it can`t be done then i`ll try it
Thursday, August 11, 2016 9:07 PM -
Need to use AT-Commands to send SMS via a by a form containing simple button. but can't find the ports available in ComboBox
This question is already answered many times at the proper place. For instance:
http://www.vbforums.com/showthread.php?330061-Get-list-of-available-comm-port- Proposed as answer by Cor Ligthert Thursday, August 11, 2016 10:27 PM
- Marked as answer by Faraz A. Qureshi Saturday, November 19, 2016 3:20 PM
Thursday, August 11, 2016 10:17 PM -
Hello,
Use the following forum for vb6 questions.
http://www.vbforums.com/forumdisplay.php?1-Visual-Basic-6-and-Earlier
Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
VB Forums - moderator
Thursday, August 11, 2016 11:17 PM -
Well!
Thanx anyway! I had already approached that before posting here but VBForums is not reachable for a couple of days from here!
Friday, August 12, 2016 6:31 AM -
Sorry for inconvenience!
VBForums is not accessible from my place! Ignore the question if causing you trouble.
Friday, August 12, 2016 6:33 AM -
Hi,
I have never used VB6 thus haven't used such an old structure.
While a similar project in VB.Net works good I can't find a similar code in VB6.
Why would you use VB6 then?
Karl
When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
My Blog: Unlock PowerShell
My Book: Windows PowerShell 2.0 Bible
My E-mail: -join('6D73646E5F6B61726C406F75746C6F6F6B2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})Tuesday, August 16, 2016 3:28 PM