PDA

Click to See Complete Forum and Search --> : VB6 - Sending SMS


nino
Dec 24th, 2005, 10:45 AM
hi all, i developed a small app that would keep track of user defined buzz words on a website, the notification was e-mail, song, msg box but all of these are no good unless your sitting at a computer so i decided to create a way of sending a SMS message.

This has been discussed before but i dont think theres a working sample.

Basically i am using VB to fill in the information into a free SMS website.


'********************************************************
'* Created by Antonio Cassidy AKA Nino *
'* Antonio@fruitvalestudios.com *
'* *
'*Add reference to Microsoft HTML Object Library *
'*Add component Microsoft Internet Controls *
'********************************************************

Option Explicit
Dim hDoc As MSHTML.HTMLDocument
Dim hInp As MSHTML.HTMLInputElement

'counter to add a pause
Dim pausecount As Integer

'fills in the logon details to sign onto the SMS service
Private Sub Command1_Click()
Set hInp = hDoc.getElementById("mobile")
hInp.focus
hInp.Value = txtuserName.Text
Set hInp = hDoc.getElementById("pin")
hInp.focus
hInp.Value = txtPin.Text
SendKeys "{ENTER}", True
Set hDoc = WebBrowser2.Document
Timer1.Interval = 1000
Timer1.Enabled = True
End Sub

Private Sub Form_Load()
WebBrowser2.Navigate2 "http://www.bubbletext.co.uk/"
End Sub


'I was experiencing problems with the sending message part it was
'trying to fill the information in before the page fully loaded,
'this will "pause" the program for a few seconds then call the message
Private Sub Timer1_Timer()
If pausecount > 2 Then
Call message
Timer1.Enabled = False
End If
pausecount = pausecount + 1
End Sub

Private Sub WebBrowser2_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
Set hDoc = WebBrowser2.Document
End Sub

'Sends the information from the text boxes to the online webform
'tabs and accepts the terms and conditions and tabs and presses
'enter
Private Sub message()
Set hInp = hDoc.getElementById("mobile")
hInp.focus
hInp.Value = txtTo.Text
Set hInp = hDoc.getElementById("fromname")
hInp.focus
hInp.Value = txtfrom.Text
Set hInp = hDoc.getElementById("txtMessage")
hInp.focus
hInp.Value = txtText.Text
SendKeys "{TAB 2}", True
SendKeys " ", True
SendKeys "{TAB 2}", True
SendKeys "{ENTER}", True
End Sub

http://img522.imageshack.us/img522/4047/sms5ib.th.jpg (http://img522.imageshack.us/my.php?image=sms5ib.jpg)

The code that deals with the data entry onto the website will be different for each website so some editing will be required but the service i picked was specifically due to the fact i could get the names of the fields and there were no OCR validation and of course its free and fast!!

This is just a sample so theres no validation on the numbers entered etc

If you want to see what the code is doing via the website turn the web browser to visible and it loads and enteres data so quick so theres not much to see lol

Enjoy and let me know what anyone thinks!

Thanks

Nino

shirazamod
Dec 27th, 2005, 09:27 AM
Wow, I've actually been developing something just like this for a program that I'm currently writing. I've made it so that it'll send you an sms alert when you receive email in Gmail and it can even send you an MMS of the email content.
I did it exactly the same way as you!!
Great minds think alike... :D