geri sayım

24/02/2012, 16:29

ondercesmeci

Arkadaşlar merhaba.
butona bastığımda geri sayım başlıyor, bitincede sesi çalıyor.
benim istediğim ise ek olarak son 5 sn kalınca her saniyede uyaran bip sesi çalması ve yukarıda yazdığım şekilde bitmesi. kodu aşağıda gönderdim
ilginize ve bilginize teşekkür ederim.
Private Declare Function sndPlaySound Lib "winmm.dll" _
Alias "sndPlaySoundA" _
(ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long

Private Declare Function PlaySound Lib "winmm.dll" _
Alias "PlaySoundA" _
(ByVal lpszName As String, _
ByVal hModule As Long, _
ByVal dwFlags As Long) As Long

' Sound Flag
Private Const SOUND_FILENAME = &H20000


Private Sub CommandButton1_Click()
Dim PauseTime, Start, Finish, TotalTime, x, Retval
For x = 30 To 0 Step -1
Me.TextBox1.Text = Str(x)
PauseTime = 1 ' Set duration.
Start = Timer ' Set start time.
Do While Timer < Start + PauseTime
DoEvents ' Yield to other processes.
Loop

Next x
Debug.Print PlaySoundFileB("C:\WINDOWS\Media\tada.wav")


End Sub

Public Function PlaySoundFileB(ByVal sndFileName As String) As Boolean

Dim iSuccess As Integer
iSuccess = PlaySound(sndFileName, 0&, SOUND_FILENAME)
If iSuccess = 0 Then
PlaySoundFileB = False
Else
PlaySoundFileB = True
End If

End Function
24/02/2012, 22:39

Yandemir

For x = 30 To 0 Step -1
Me.Text1 = str(x)
If Me.Text1 <= 5 Then Debug.Print PlaySoundFileB("C:\WINDOWS\Media\Windows Ding.wav")

PauseTime = 1 ' Set duration.
Start = Timer ' Set start time.
Do While Timer < Start + PauseTime
DoEvents ' Yield to other processes.
Loop

Next x
Debug.Print PlaySoundFileB("C:\WINDOWS\Media\tada.wav")
28/02/2012, 10:01

ondercesmeci

Sn. Yandemir
İlginize ve bilginize çok teşekkür ederim.