locked
I want to know more about VB RRS feed

  • Question

  • Do you know how to create a program to send and receive sms and call from PC from and or to any devices? Please answer it completely, ok?

    Saturday, April 12, 2008 2:22 PM

Answers

  • Hi! – I think my information could help you.

    You know you could use like I said before, GSM system to send Short Message Service (SMS).

    I’ve found some other information which could help you, MSRIndia SMS toolkit could help you.

    Everybody which builds software which needs to do something unusual needs to use references which already exist or they need to download a Software Development Kit (SDK) which has all the required components which are needed if you would like to send a SMS with your application.

     

    The MSRIndia has an online service which allows the application to connect and then send the SMS from the MSRIndia server.  

     

    If you would like to just send SMS to a Nokia mobile the do the following:

    Device:
    1. Mobile phone (Nokia Models Only).
    2. Connecting Device (Such as: Infrared, DataCable, or Bluetooth).
    3. Download the appropriate
    Nokia PC Connectivity SDK depends on the version or model of the Nokia® Phone you are using.

    Nokia PC Connectivity SDK depends on the version or model of the Nokia® Phone you are using.

     

    Steps to do:

    1. Install the connecting device (Such as: Infrared, DataCable, or Bluetooth) in you pc.
    NOTE: You must connect first the phone to your pc before installing.

    2.
    Install the Nokia® PC Connectivity.
    3. Open a Visual Studio and start new project.
    4. Add the Nokia® Components in your preferences.
    5. Then copy the code below.

     

    The code bellow is the code which you could use for your VBApplication.

    Note: You need the required Nokia® references to run the code.

     

    Code Snippet

    Imports Microsoft.VisualBasic

    Public Class Class1

    Private Sub button1_click()

    Dim message As String

    message = txtMsg.Text 'This is a (TextBox).

    Select Case chkUnicode.Value

    Case vbUnchecked

    If (Len(message) > SMS_TEXT_MAX_SIZE) Then

    pMsgPart1 = Left(message, SMS_CONCATENATED_TEXT_MAX_SIZE)

    pMsgPart2 = Right(message, Len(message) - SMS_CONCATENATED_TEXT_MAX_SIZE)

    SendConcatenatedMessage()

    Exit Sub

    End If

    Case vbChecked

    If (Len(message) > SMS_UNICODE_MAX_SIZE) Then

    pMsgPart1 = Left(message, SMS_CONCATENATED_UNICODE_MAX_SIZE)

    pMsgPart2 = Right(message, Len(message) - SMS_CONCATENATED_UNICODE_MAX_SIZE)

    SendConcatenatedMessage()

    Exit Sub

    End If

    Case Else

    MsgBox("Select coding scheme")

    End Select

    Dim smsEntry As NokiaCLMessaging.ShortMessageItem

    smsEntry = New NokiaCLMessaging.ShortMessageItem

    smsEntry.Type = SHORTMESSAGE_TYPE_GSM_SUBMIT 'This is a GSM function to SUNMIT SMS.

    pIGSMSubmit = smsEntry.TypeProperties 'This is the GSM SMS properties.

    pIGSMSubmit.message = txtMsg.Text 'A message TextBox.

    pIGSMSubmit.DestinationAddress = txtDestination.Text 'Also a TextBox.

    pIGSMSubmit.ServiceCenterAddress = txtMsgCenter.Text 'Also a TextBox.

    pIGSMSubmit.ProtocolID = 0 'This is the GSMSubmit protocol ID.

    If (chkUnicode.Value = vbChecked) Then

    pIGSMSubmit.DataCodingScheme = CODING_SCHEME_UNICODE

    Else

    pIGSMSubmit.DataCodingScheme = CODING_SCHEME_TEXT

    End If

    pIGSMSubmit.ValidityPeriodRelative = 255

    Call pSMSAdapter.SendSMS(SHORTMESSAGE_ROUTE_TYPE_ANY, pIGSMSubmit)

    'Insert your code here to store the sent message in the database.

     

    MsgBox("Message Sent TO " & txtDestination.Text & vbCrLf & "With Reference Number: " & pIGSMSubmit.MessageReference, vbOKOnly, "Message Sent")

    Exit Sub

    ErrorTrap:

    If Err.Number = -2147467259 Or Err.Number = -2147467259 Then

    End If

    MsgBox(Err.Description, vbInformation, "SMS Cannot Send")

    End Sub

    End Class

     

     

     

    And take a look on this information bellow:

    http://www.codeplex.com/smstoolkit

    The MSRIndia blog:

    http://msrindia.spaces.live.com/

    Here is more information about the MSRIndia SMS toolkit:

    http://www.vinodlive.com/2007/03/08/microsoft-sms-toolkit-and-warana-unwired-project/

    Microsoft® Research site:

    http://research.microsoft.com/research/downloads/details/2bdeb3c6-9945-4804-a9bc-0d53704d35da/details.aspx

     

    If Microsoft® Corporation info couldn’t help you then visit this:

    http://www.activexperts.com/activsms/howto/gsm/vb/

    Here is the ActiveXperts File Transfer Protocol (FTP) site:

    ftp://ftp.activexperts-labs.com/samples/xmstoolkit/Visual%20Basic.NET/Windows%20Applications/Demo/

     

     

    Figure A The ActiveXperts SMS and MMS Toolkit 5.0 Type Library 1.0 reference.

     

    I hope this informaion could solve your problem.

     

    I wish you the best of luck......

     

     

     

    Friday, April 18, 2008 7:02 PM

All replies

  • HI! – Tawi

    I think my information could help you…You said that you want to create an application, which could send sms and call other phones.   

    Note:  you need a GSM modem which works. Read more about GSM-modems.

    Note: you maybe also need to add some references to your application.

    Required: tools http://msdn2.microsoft.com/en-us/windowsmobile/bb264335.aspx

    Find more information here: http://www.opennetcf.org/CategoryView.aspx?category=Home

    Are you a beginner? If, then visit the following Msdn Microsoft Visual Basic 2005 learn site:

    http://msdn2.microsoft.com/en-us/express/aa718408.aspx (Recommended)

     Do the following steps:

    These functions could just send a SMS to a mobile.

    1.       Start Microsoft Visual Studio and create a new windowsapplication.

    2.       Add a new class and name it to: “SMS”.

    3.       Copy and paste the following code, which is bellow:

    Code Snippet

    Option Explicit On   

     

    Imports System

    Imports System.Threading

    Imports System.ComponentModel

    Imports System.IO.PortsPublic Class SMS  

     

    Private WithEvents SMSPort As SerialPort   

     

        Private SMSThread As Thread

        Private ReadThread As Thread

        Shared _Continue As Boolean = False

        Shared _ContSMS As Boolean = False

        Private _Wait As Boolean = False

        Shared _ReadPort As Boolean = False

        Public Event Sending(ByVal Done As Boolean)

        Public Event DataReceived(ByVal Message As String)   

     

        Public Sub New(ByRef COMMPORT As String)

            SMSPort = New SerialPort

            With SMSPort

                .PortName = COMMPORT

                .BaudRate = 9600

                .Parity = Parity.None

                .DataBits = 8

                .StopBits = StopBits.One

                .Handshake = Handshake.RequestToSend

                    .DtrEnable = True

                  .RtsEnable = True

                .NewLine = vbCrLf

            End With

            ReadThread = New Thread(AddressOf ReadPort)

            End Sub   

     

        Public Function SendSMS(ByVal CellNumber As String,

            ByVal SMSMessage As String) As Boolean

            Dim MyMessage As String = Nothing

            'Check if Message Length <= 160

            If SMSMessage.Length <= 160 Then

                MyMessage = SMSMessage

            Else

                  MyMessage = Mid(SMSMessage, 1, 160)

            End If

            If IsOpen = True Then

                    SMSPort.WriteLine("AT+CMGS=" & CellNumber & vbCr)

                    _ContSMS = False

                    SMSPort.WriteLine(MyMessage & vbCrLf & Chr(26))

                    _Continue = False

                    RaiseEvent Sending(False)

            End If

        End Function   

     

    I hope this info helped...

    I wish you The Best Of luck...

    Saturday, April 12, 2008 4:11 PM
  • Hi! - Tawi

     

    Here is more code which need to be pasted on the same class:

     

    Code Snippet

      Private Sub ReadPort()

              Dim SerialIn As String = Nothing

            Dim RXBuffer(SMSPort.ReadBufferSize) As Byte

            Dim SMSMessage As String = Nothing

            Dim Strpos As Integer = 0

            Dim TmpStr As String = Nothing   

     

                While SMSPort.IsOpen = True

                If (SMSPort.BytesToRead <> 0) And (

                    SMSPort.IsOpen = True) Then

                    While SMSPort.BytesToRead <> 0

                        SMSPort.Read(RXBuffer, 0, SMSPort.ReadBufferSize)

                        SerialIn =

                            SerialIn & System.Text.Encoding.ASCII.GetString(

                            RXBuffer)

                        If SerialIn.Contains(">") = True Then

                            _ContSMS = True

                        End If

                        If SerialIn.Contains("+CMGS:") = True Then

                            _Continue = True

                            RaiseEvent Sending(True)

                            _Wait = False

                            SerialIn = String.Empty

                            ReDim RXBuffer(SMSPort.ReadBufferSize)

                        End If

                    End While

                    RaiseEvent DataReceived(SerialIn)

                    SerialIn = String.Empty

                    ReDim RXBuffer(SMSPort.ReadBufferSize)

                End If

            End While

        End Sub   

     

        Public ReadOnly Property IsOpen() As Boolean

            Get

                If SMSPort.IsOpen = True Then

                    IsOpen = True

                Else

                    IsOpen = False

                End If

            End Get

        End Property   

     

        Public Sub Open()

            If IsOpen = False Then

                SMSPort.Open()

                ReadThread.Start()

            End If

        End Sub   

     

        Public Sub Close()

            If IsOpen = True Then

                SMSPort.Close()

            End If

        End Sub   

     

    End Class

     

    Use the following code to get it work on the WindowsApplication:

     

    Code Snippet
    SMSEngine = New SMS("COM1")SMSEngine.Open()SMSEngine.SendSMS("919888888888","SMS Testing")SMSEngine.Close()

     

     

    You could add some buttons and some text boxes which could make it look better.

    I hope this information helped you...

    I wich you The best Of luck.......

     

    Saturday, April 12, 2008 4:45 PM
  • Hi! - Tawi

     

    How to Receive SMS?

    Visit and find out how:

    http://www.codeproject.com/KB/vb/phonesmsrecv.aspx

     

    I wish you The Best of luck!....

    Saturday, April 12, 2008 4:48 PM
  • Hi! - Twai

     

    Here is a image which shows how it works:

    Screenshot - SendSMS.jpg

    Figure1:1 Send a SMS to a mobile or a cell-phone.

     

    I wish you The best of luck....

     

     

    Saturday, April 12, 2008 4:52 PM
  • Where should I add those code? Do you have the code without need to use any gsm or cdma phone? Where can I find complete vb key words? And how to call any other pcs and any other mobile phone without any gsm or any cdma phone?

    Wednesday, April 16, 2008 10:50 AM
  •  Tawi wrote:

    Where should I add those code? Do you have the code without need to use any gsm or cdma phone? Where can I find complete vb key words? And how to call any other pcs and any other mobile phone without any gsm or any cdma phone?

     

    Hi!

     

    Could you wait until friday, this friday..I'im bussy right now got school work

    I will help you as soon as I've got some time. I will tel you how to do okay I can not promise that I've got the right solution for you but wait because when friday comes I got time a lot of time.  

     

    Have a nice day...

     

    Wednesday, April 16, 2008 5:07 PM
  • Hi Tawi,

    If you don't prefer to use the mobile phone to send and receive SMS, you can try some web service which is used to send and receive SMS. Read How to send and receive SMS with the Orange SMS API for your reference. You can use some code converter to get the VB.Net code for you.

    Best regards,
    Riquel

    This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.



    Thursday, April 17, 2008 6:12 AM
    Moderator
  • Hi! – I think my information could help you.

    You know you could use like I said before, GSM system to send Short Message Service (SMS).

    I’ve found some other information which could help you, MSRIndia SMS toolkit could help you.

    Everybody which builds software which needs to do something unusual needs to use references which already exist or they need to download a Software Development Kit (SDK) which has all the required components which are needed if you would like to send a SMS with your application.

     

    The MSRIndia has an online service which allows the application to connect and then send the SMS from the MSRIndia server.  

     

    If you would like to just send SMS to a Nokia mobile the do the following:

    Device:
    1. Mobile phone (Nokia Models Only).
    2. Connecting Device (Such as: Infrared, DataCable, or Bluetooth).
    3. Download the appropriate
    Nokia PC Connectivity SDK depends on the version or model of the Nokia® Phone you are using.

    Nokia PC Connectivity SDK depends on the version or model of the Nokia® Phone you are using.

     

    Steps to do:

    1. Install the connecting device (Such as: Infrared, DataCable, or Bluetooth) in you pc.
    NOTE: You must connect first the phone to your pc before installing.

    2.
    Install the Nokia® PC Connectivity.
    3. Open a Visual Studio and start new project.
    4. Add the Nokia® Components in your preferences.
    5. Then copy the code below.

     

    The code bellow is the code which you could use for your VBApplication.

    Note: You need the required Nokia® references to run the code.

     

    Code Snippet

    Imports Microsoft.VisualBasic

    Public Class Class1

    Private Sub button1_click()

    Dim message As String

    message = txtMsg.Text 'This is a (TextBox).

    Select Case chkUnicode.Value

    Case vbUnchecked

    If (Len(message) > SMS_TEXT_MAX_SIZE) Then

    pMsgPart1 = Left(message, SMS_CONCATENATED_TEXT_MAX_SIZE)

    pMsgPart2 = Right(message, Len(message) - SMS_CONCATENATED_TEXT_MAX_SIZE)

    SendConcatenatedMessage()

    Exit Sub

    End If

    Case vbChecked

    If (Len(message) > SMS_UNICODE_MAX_SIZE) Then

    pMsgPart1 = Left(message, SMS_CONCATENATED_UNICODE_MAX_SIZE)

    pMsgPart2 = Right(message, Len(message) - SMS_CONCATENATED_UNICODE_MAX_SIZE)

    SendConcatenatedMessage()

    Exit Sub

    End If

    Case Else

    MsgBox("Select coding scheme")

    End Select

    Dim smsEntry As NokiaCLMessaging.ShortMessageItem

    smsEntry = New NokiaCLMessaging.ShortMessageItem

    smsEntry.Type = SHORTMESSAGE_TYPE_GSM_SUBMIT 'This is a GSM function to SUNMIT SMS.

    pIGSMSubmit = smsEntry.TypeProperties 'This is the GSM SMS properties.

    pIGSMSubmit.message = txtMsg.Text 'A message TextBox.

    pIGSMSubmit.DestinationAddress = txtDestination.Text 'Also a TextBox.

    pIGSMSubmit.ServiceCenterAddress = txtMsgCenter.Text 'Also a TextBox.

    pIGSMSubmit.ProtocolID = 0 'This is the GSMSubmit protocol ID.

    If (chkUnicode.Value = vbChecked) Then

    pIGSMSubmit.DataCodingScheme = CODING_SCHEME_UNICODE

    Else

    pIGSMSubmit.DataCodingScheme = CODING_SCHEME_TEXT

    End If

    pIGSMSubmit.ValidityPeriodRelative = 255

    Call pSMSAdapter.SendSMS(SHORTMESSAGE_ROUTE_TYPE_ANY, pIGSMSubmit)

    'Insert your code here to store the sent message in the database.

     

    MsgBox("Message Sent TO " & txtDestination.Text & vbCrLf & "With Reference Number: " & pIGSMSubmit.MessageReference, vbOKOnly, "Message Sent")

    Exit Sub

    ErrorTrap:

    If Err.Number = -2147467259 Or Err.Number = -2147467259 Then

    End If

    MsgBox(Err.Description, vbInformation, "SMS Cannot Send")

    End Sub

    End Class

     

     

     

    And take a look on this information bellow:

    http://www.codeplex.com/smstoolkit

    The MSRIndia blog:

    http://msrindia.spaces.live.com/

    Here is more information about the MSRIndia SMS toolkit:

    http://www.vinodlive.com/2007/03/08/microsoft-sms-toolkit-and-warana-unwired-project/

    Microsoft® Research site:

    http://research.microsoft.com/research/downloads/details/2bdeb3c6-9945-4804-a9bc-0d53704d35da/details.aspx

     

    If Microsoft® Corporation info couldn’t help you then visit this:

    http://www.activexperts.com/activsms/howto/gsm/vb/

    Here is the ActiveXperts File Transfer Protocol (FTP) site:

    ftp://ftp.activexperts-labs.com/samples/xmstoolkit/Visual%20Basic.NET/Windows%20Applications/Demo/

     

     

    Figure A The ActiveXperts SMS and MMS Toolkit 5.0 Type Library 1.0 reference.

     

    I hope this informaion could solve your problem.

     

    I wish you the best of luck......

     

     

     

    Friday, April 18, 2008 7:02 PM
  • hi'

    i like your information which you had given can you help me to develop small project that i can learn more about visual basic......

    Wednesday, August 10, 2011 10:01 AM
  • hi,

    i dont know more about visual basic if you want please teach me....

    i know only to do small project yet i not did any good project i felt with your help i can do it please help me....

    just now i completed my diploma im fresher in company so please if you can then help me

    Wednesday, August 10, 2011 10:05 AM
  • i dont know about this if u teach me i can learn this

    my Email id is dayanand.gavas@bridgeitautomation.com

    please soon inform me on my Email id ok

    Wednesday, August 10, 2011 10:07 AM