Give the "Gift of Text" by sending an SMS with VB.NET and Skype

Standard

image

Never underestimate the value (to some) of sending someone a note.  In my case, a note to my beloved is an excellent way of ensuring a happier homecoming.

Each note has to have an appropriately original sentiment, and be sent in a timely fashion.  Sometimes circumstances do not permit time for the creative effort required.   (Although I’ve heard that Generation Y can shoot of a text message faster than I just wrote the word faster…)

So why not queue up some appropriate messages and let my computer send one a day at the appropriate time?  Yes I’m sure you can think of plenty, but this is just an intro to a code sample….

So to send an SMS, all you need to do is install Skype and get a reference to the COM type library:

image

 

After this, the following code sample should be enough to get you in trouble:

 

Public Sub SendSMS(ByVal strNumber As String, ByVal strBody As String)
    Dim loSkype As New SKYPE4COMLib.Skype
    Dim loSmsMessage As SKYPE4COMLib.SmsMessage

    loSmsMessage = loSkype.CreateSms(SKYPE4COMLib.TSmsMessageType.smsMessageTypeOutgoing, strNumber)
    loSmsMessage.Body = strBody
    loSmsMessage.Send()
    Trace.WriteLine(loSmsMessage.Status.ToString)

    loSmsMessage = Nothing
    loSkype = Nothing

End Sub

 

Have fun!

Links

Original VBA post by Conrad Sharry

Share this post :

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s