borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB Home | News Home | Forum Home | Downloads | Register | Search | PM | Profile

Previous Topic (Anti-crack and anti-piracy application protection by Code morphing)Next Topic (Testing and Debugging Windows Services and Web Services in .NET Framework) New Topic Post Reply
AndreaVB OnLine : Articles and tutorials : Send SMS from PC to mobile phones using VB
Poster Resource
TJ_01
Level: VB Lord


Registered: 24-08-2005
Posts: 320
icon Send SMS from PC to mobile phones using VB

Hi.

These topic is for those who wants to learn how to send SMS (Short Message Service) from pc to mobile phones.

Devices
1. Mobile phone (Nokia Model 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.

Procedures
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.

Private Sub cmdSend_Click()
On Error GoTo ErrorTrap
    
    Dim message As String
    message = txtMsg.Text
    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
    Set smsEntry = New NokiaCLMessaging.ShortMessageItem
    
    smsEntry.Type = SHORTMESSAGE_TYPE_GSM_SUBMIT
    Set pIGSMSubmit = smsEntry.TypeProperties
    
    pIGSMSubmit.message = txtMsg.Text
    pIGSMSubmit.DestinationAddress = txtDestination.Text
    pIGSMSubmit.ServiceCenterAddress = txtMsgCenter.Text
    pIGSMSubmit.ProtocolID = 0
    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




[Edited by admin on 01-10-2005 at 12:45 PM GMT]

____________________________
Im JAMES  

29-08-2005 at 04:11 AM
View Profile Send Email to User Show All Posts | Add Comment
luckyboy
Level: VB Lord

Registered: 05-05-2005
Posts: 160
icon Re: SEND SMS FROM PC TO MOBILE PHONES USING VB

How about no device? can we send from pc to phone(no device require)?

____________________________
Please help out.

16-09-2005 at 09:50 AM
View Profile Send Email to User Show All Posts | Add Comment
TJ_01
Level: VB Lord


Registered: 24-08-2005
Posts: 320
icon Re: SEND SMS FROM PC TO MOBILE PHONES USING VB

Yes. You can use a modem as your device but the code is not similar compare to the code i have written. You gonna use AT Commands.

____________________________
Im JAMES  

28-09-2005 at 06:30 AM
View Profile Send Email to User Show All Posts | Add Comment
resty2k5
Level: Trainee

Registered: 03-10-2005
Posts: 2
icon Re: SEND SMS FROM PC TO MOBILE PHONES USING VB

quote:
TJ_01 wrote:
Yes. You can use a modem as your device but the code is not similar compare to the code i have written. You gonna use AT Commands.


can you give me sample code for AT command b'coz i'm newbie for this syntax
03-10-2005 at 07:10 AM
View Profile Send Email to User Show All Posts | Add Comment
potetojb
Level: Protégé

Registered: 27-03-2006
Posts: 4
icon Re: Send SMS from PC to mobile phones using VB

if i want change use sony  ericsson phone (T610) with At command what part i much change..

27-03-2006 at 08:20 AM
View Profile Send Email to User Show All Posts | Add Comment
nkmomin
Level: Protégé

Registered: 21-09-2006
Posts: 6
icon Re: Send SMS from PC to mobile phones using VB

Hi all i am a new over here.

I am facing some problem in this code. this doesn't work for me can some one please find a solution to that and suggest me how to send bulk sms via VB.

please

Thanks in Advance....

21-09-2006 at 03:05 PM
View Profile Send Email to User Show All Posts | Add Comment
AndreaVB OnLine : Articles and tutorials : Send SMS from PC to mobile phones using VB
Previous Topic (Anti-crack and anti-piracy application protection by Code morphing)Next Topic (Testing and Debugging Windows Services and Web Services in .NET Framework)New Topic Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder