Untuk proyek kita kali ini membutuhkan controll, yaitu :
- 2 text box dengan propertis name text1 dan text2
- 4 command buttons dengan properties namenya standar/default tanpa perubahan.
- 3 label dengan properties name default
- contoh-contoh file sound wav yang diletakan di luar aplikasi
- timer dengan properties name timer1 dan dengan interval 100.
Tuliskan code di bawah ini pada modul
Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" _ (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long Const SND_SYNC = &H0 Const SND_ASYNC = &H1 Const SND_NODEFAULT = &H2 Const SND_LOOP = &H8 Const SND_NOSTOP = &H10 Sub PlayWaveSoundOkExit_Click() soundfile$ = "audio\rain_tag_water.wav" wFlags% = SND_ASYNC Or SND_NODEFAULT HaHa = sndPlaySound(soundfile$, wFlags%) End Sub Sub StopTheSound_Click() StopTheSoundNOW = sndPlaySound(soundfile$, wFlags%) End Sub Sub PlayWaveSoundIntro_Click() soundfile$ = "audio\a_sparrow.wav" wFlags% = SND_ASYNC Or SND_NODEFAULT HaHa = sndPlaySound(soundfile$, wFlags%) End Sub Sub PlayWaveSoundLblTxt_Click() soundfile$ = "audio\e_twigs.wav" wFlags% = SND_ASYNC Or SND_NODEFAULT HaHa = sndPlaySound(soundfile$, wFlags%) End Sub Sub PlayWaveSoundAyam_Click() soundfile$ = "audio\Ayam berkokok.wav" wFlags% = SND_ASYNC Or SND_NODEFAULT HaHa = sndPlaySound(soundfile$, wFlags%) End Sub
Tuliskan code di bawah ini pada Form
Private Sub Command1_Click() PlayWaveSoundOkExit_Click End End Sub Private Sub Command2_Click() PlayWaveSoundAyam_Click End Sub Private Sub Command3_Click() StopTheSoundNOW = sndPlaySound(soundfile$, wFlags%) End Sub Private Sub Command4_Click() PlayWaveSoundOkExit_Click Timer1.Enabled = False Command2.Visible = True Command3.Visible = True Command4.Visible = False Command1.Visible = True End Sub Private Sub Form_Load() PlayWaveSoundIntro_Click MsgBox "Sound Wav Intro telah berbunyi, selanjutnya Sound Wav saat menekan Ok", vbOKOnly, "Info" PlayWaveSoundOkExit_Click End Sub Private Sub Text1_Change() PlayWaveSoundLblTxt_Click End Sub Private Sub Text2_Change() PlayWaveSoundLblTxt_Click End Sub Private Sub Timer1_Timer() If Not Text1.Text = "" And Not Text2.Text = "" Then Command4.Visible = True Else Command4.Visible = False End If If Label3.ForeColor = &HFFFFFF Then Label3.ForeColor = &H80000008 Else Label3.ForeColor = &HFFFFFF End If End Sub
Terimakasih, semoga bermanfaat.
Download Menambah Sound Wav
Kok Gak Bisa di download...???/
ReplyDeleteCoba terus pasti bisa deh..he..he..
ReplyDeleteCoba terus pasti bisa karena yang lain juga udah download
ReplyDeleteEhh.. ternyata file upload mengenai penambahan soundwav hilang dari folder 4shared, padahal tidak saya hapus. Sial deh.. maaf yang ingn download nunggu setelah saya upload lagi yach. I'm So Sorry....
ReplyDeleteBisa nggak dijelasin arti dari :
ReplyDeleteConst SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_NODEFAULT = &H2
Const SND_LOOP = &H8
Const SND_NOSTOP = &H10
Q agak g ngerti tentang &H0, &H1, dll
Sama mas Galzz.. heehe.. coba nanti tak cari2..
ReplyDeleteMas kalau bikin sound untuk Client - Server gimana y?
ReplyDeletejadi kalau connect or disconnect servernya bunyi