Home > HP, TIPS & TRICK > Mengirim SMS Lewat Komputer

Mengirim SMS Lewat Komputer

Kali ini saya akan memberikan sedikit informasi untuk dapat membuat sebuah program yang dapat mengirim sms melalui komputer:

1. Saya menggunakan hp Siemens C55 sebagai modem yang dapat menerima dan mengirim SMS.
2. Saya menggunakan OCX yang bisa saya download dari Activexperts.com
3. Saya membeli kabel USB-To Serial merk Prolific untuk koneksi C55 dengan komputer

kemudian dengan kemampuan VB saya yang terbatas saya membuat form untuk mengirim SMS seperti dibawah ini:

untuk menerima sms baru saja saya buat formnya :

gimana dengan source codenya di vb?

Public objConstants As ASmsCtrl.Constants
Public objGsmOut As ASmsCtrl.GsmOut
Public objGsmIn As ASmsCtrl.GsmIn

Private Declare Function GetTempPath Lib “kernel32? Alias “GetTempPathA” (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Private Const MAX_PATH = 260

Dim conn As ADODB.Connection
Dim reco As ADODB.Recordset
Dim strcon As String

Private Sub Command1_Click()
Form1.Refresh

txtpenerima.Text = “”
txtberita.Text = “”

End Sub

Private Sub Command2_Click()
conn.Close
Form2.Show
Form1.Hide
End Sub

Private Sub Command3_Click()
quit

End Sub

Private Sub Form_Load()
Set objGsmOut = CreateObject(”ActiveXperts.GsmOut”)

Dim devicecount As Long
Set conn = New ADODB.Connection
Set reco = New ADODB.Recordset

‘———-database access
strcon = “Provider = Microsoft.Jet.OLEDB.4.0;” & _
“Data Source=” & App.Path & “\wecsmslog.mdb;”

conn.CursorLocation = adUseClient

‘membuka koneksi
‘conn.ConnectionString = strcon
conn.Open strcon

‘cek apakah koneksinya tersambung?
If conn.State = adStateClosed Then
MsgBox “Database tidak terkoneksi….”
Else
MsgBox “database sudah konak”, 1

‘jalankan sql nya
reco.Open “select * from outbox”, conn, adOpenKeyset, adLockOptimistic

‘jika record sudah ada, arahkan pada record pertama
If reco.RecordCount > 0 Then reco.MoveFirst

recawal = reco.BOF
recakhir = reco.EOF

End If
‘———-koneksi database selesai

txtpenerima.Text = “”
txtberita.Text = “”

lDeviceCount = objGsmOut.GetDeviceCount() ‘ Get number of devices

For i = 0 To lDeviceCount – 1
cmbport.AddItem (objGsmOut.GetDevice(i)) ‘ Add devices to list box
Next

For i = 0 To portnya – 1
cmbport.AddItem (i) ‘ Add devices to list box
Next

cmbport.AddItem (”COM1?) ‘ Add serial devices
cmbport.AddItem (”COM2?)
cmbport.AddItem (”COM3?)
cmbport.AddItem (”COM4?)
cmbport.AddItem (”COM5?)
cmbport.AddItem (”COM6?)
cmbport.AddItem (”COM7?)
cmbport.AddItem (”COM8?)
cmbport.AddItem (”COM9?)
cmbport.AddItem (”COM10?)
cmbport.ListIndex = 0

End Sub
Private Sub cmdsend_Click()

For i = 0 To portnya – 1
cmbport.AddItem (i) ‘ Add devices to list box
Next

If Check1.Value = Checked Then
laporan = True
Else
laporan = False
End If

objGsmOut.Device = cmbport.Text ‘ Use a Nokia Windows Telephony device
‘objGsmOut.MessageRecipient = “+6281335337791? ‘ Recipient’s mobile number
objGsmOut.MessageRecipient = txtpenerima.Text
‘objGsmOut.MessageData = “coba deh” ‘ SMS message text
objGsmOut.MessageData = txtberita.Text

objGsmOut.RequestStatusReport = laporan ‘ No request for status report
objGsmOut.ValidityPeriod = 0 ‘ Use GSM operator’s default retry time

‘objGsmOut.EnterPin (”1234?) ‘ SIM card’s PIN code
objGsmOut.Send

If objGsmOut.LastError = 0 Then
MsgBox “Message successfully delivered.”, 1

Else
MsgBox “Error: ” & objGsmOut.LastError
End If

conn.Execute “INSERT INTO outbox ” & _
“(tglkirim, jamkirim, nopenerima, berita) ” & _
“values (#” & Date & “#,#” & Time & “#,’” & txtpenerima.Text & “‘,’” & txtberita.Text & “‘);”
reco.Requery

End Sub

yah yang jelas aplikasi ini masih perlu banyak pengembangan terutama pada tampilan, database dan fasilitas yang lain🙂

Categories: HP, TIPS & TRICK
  1. 7 August 2009 at 12:04

    Great bro..
    Tapi untuk hape2 siemens semuanya suport pake ngirim2 SMS via Soft PC tuh.. Mas bisa cari Software SiMoCo (Siemens Mobile Control), dengan SiMoCo, hampir semua hape siemens bisa eksplore termasuk ngirim n terima SMS…

    Monggo Dicoba

  1. No trackbacks yet.

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

%d bloggers like this: