I would love a simple example program to create Sending SMS using VB6, Gammu and MySQL database
Maybe you have to know and have already discussed about this, but just sharing it. For that use PHP, JAVA and others may have a lot, I try to use VB6. If later I add a lot of other interests.
combat equipment provided:
– Software VB6 course
– ODBC Driver (preferably the latest version 5.1) on the download here:
1 |
http://dev.mysql.com/downloads/connector/odbc/ |
– Web servers, I use XAMPP. The others are also biased for example WAMP:
1 |
http://www.apachefriends.org/en/xampp-windows.html |
– Gammu Can be downloaded here:
1 |
http://wammu.eu/download/gammu/win32/ |
– Mobile of course (or another modem that supports Gammu). I use a Siemens C55 (Can not be in donlot but must buy)
The steps are:
1. Install VB6, when it passed
2. Install Web Server, for example, had XAMPP
3. Install gammu / If it can be a ZIP donlot it, put it in Drive for example C:, instead of the folder so gammu. (let’s just been finished and is on C:gammu)
4. Find the file gammurc and smsdrc in C:Gammusharedocgammuexamplesconfig
5. Edit gammurc and smsdrc using notepad or another text processing.
In this fox gammurc file:
1 2 3 |
[gammu] device = com3: (change it to your modem/mobile phone port) connection = at19200 (adjust with your modem/mobile phone) |
In smsdrc file, change this
1 2 3 4 5 6 7 8 |
[gammu] port = com3: connection = at19200 service = MYSQL user = root password = pc = localhost database = sms |
Note:
devices and ports: depending on your modem port
Connection: depending on your modem connection/mobile phone
6. copy files gammurc and smsdrc into the folder
1 |
C:Gammubin |
7. run XAMPP-Control, click Start on Apache, click Start on Mysql
8. in the browser type http://localhost/phpmyadmin, create a database with the name of an sms, then IMPORT mysql.sql file located in
1 |
C:Gammusharedocgammuexamplessql |
and click GO
9. Install ODBC Driver, if it is finished go to Start -> Settings -> Control Panel -> Administrative Tools -> Data Sources (ODBC), the DSN Users click ADD.
10. The contents of the Data Source name for example SMSX, Server: localhost, port: 3306, user: root, Password blank), Database: sms
Now living a try:
1. Click Start -> Run, type CMD, on the CMD console, type:
1 |
cd:Gammu |
2. To check the modem / mobile phone already are connected anything yet type: gammu identify
3. If you are connected gammu run its service, type:
1 |
gammu-smsd-i-c smsdrc |
It is finished, the next stage live insert script below to Visual Basic (VB) 6, or the source can be downloaded here:
1 |
Source Code: http://www.4*shared.com/file/U-BoUo2J/smsvb.html |
Source code form1:
1 2 3 4 5 6 7 8 9 10 |
Private Sub Command1_Click() Dim RS As ADODB.Recordset Set RS = New ADODB.Recordset Dim SQL As String Koneksi SQL = "INSERT INTO outbox (DestinationNumber, TextDecoded, CreatorID) VALUES ('" & Nohp.Text & "','" & Pesan.Text & "', 'Gammu')" RS.CursorLocation = adUseClient RS.Open SQL, conn, adOpenDynamic, adLockOptimistic MsgBox "Pesan telah dikirim", vbOKOnly, "Kirim" End Sub |
Source code module1:
1 2 3 4 5 6 7 8 9 10 11 12 |
Public Sub Koneksi() On Error GoTo elor: Dim filename As String Dim Server, Uid, Psw, Db As String Set conn = New ADODB.Connection conn.ConnectionString = "DRIVER={MySQL ODBC 5.1 Driver};SERVER=localhost;UID=root;PWD=;DATABASE=sms;" _ & "OPTION = " & 1 + 2 + 8 + 32 + 2048 + 163841 conn.Open Exit Sub elor: MsgBox " Error Koneksi ke MySQL" + Chr(13) + "Pesan Error: " + err.Description, vbCritical, "Error" End Sub |
Hopefully useful. Please corrected if there is something wrong with Creating a Simple Program Sending SMS with VB6 and Gammu
source: tipayun
thanks its work.
please upload for auto response with visual basic 🙂 or reading inbox gammu.
mas asep,,,
ga ada eror sama sekali, mysql lancar, kesimpen di database
di vb smsnya terkirim
tapi, kok di hp yang sebenarnya (alamat tujuan) gak diterima sms yah?
Pagi pak,
Saya sudah ikuti petunjuk satu persatu, service juga sudah saya buat dan gammu-smsd.exe sudah running, tapi SMS tidak terkirim, saya lihat di database sms pesan yg dikirim sudah masuk ke table outbox.
Saya sudah coba kirim menggunakan +62 dan tanpa kode negara.
Saya menggunakan Windows 7 32bit dengan modem Wavecom M1206B.
Terima kasih atas waktunya.