# Shkenca > Informatikë dhe Internet > Arti i programimit >  Ndihme per nje kod ne Visual Basic .

## mirsadi83

E kam nje kod programimi ne Visual Basic 6 per ekzekutimin e Audios wav por me kete kod nese ekzekuton audion ajo vazhdon ashtu pa u ndalur dhe ndalet vetem ather kur e ndali vet me an te butonit dhe pres nga ju qe te me tregoni se si t'ia beje qe Audio te kendohet vetem nje her dhe te ndalet vetvetiu.

Option Explicit

Private Const SND_APPLICATION = &H80         ' look for application specific association
Private Const SND_ALIAS = &H10000     ' name is a WIN.INI [sounds] entry
Private Const SND_ALIAS_ID = &H110000    ' name is a WIN.INI [sounds] entry identifier
Private Const SND_ASYNC = &H1         ' play asynchronously
Private Const SND_FILENAME = &H20000     ' name is a file name
Private Const SND_LOOP = &H8         ' loop the sound until next sndPlaySound
Private Const SND_MEMORY = &H4         ' lpszSoundName points to a memory file
Private Const SND_NODEFAULT = &H2         ' silence not default, if sound not found
Private Const SND_NOSTOP = &H10        ' don't stop any currently playing sound
Private Const SND_NOWAIT = &H2000      ' don't wait if the driver is busy
Private Const SND_PURGE = &H40               ' purge non-static events for task
Private Const SND_RESOURCE = &H40004     ' name is a resource name or atom
Private Const SND_SYNC = &H0         ' play synchronously (default)
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Dim flag As Boolean

Private Sub Command1_Click()

If Not flag Then
  Command1.Caption = "Ndale"
  PlaySound App.Path & "\Audio.WAV", ByVal 0&, SND_ASYNC Or SND_LOOP
Else
  Command1.Caption = "Ndëgjoje këngën e shkrojave"
  PlaySound App.Path & "\Audio.WAV", ByVal 0&, SND_MEMORY
End If
flag = Not flag

End Sub

----------


## hot_prinz

Largoje SND_LOOP ajo konstante e perserit,

Nga:



> PlaySound App.Path & "\Audio.WAV", ByVal 0&, SND_ASYNC Or SND_LOOP


Ne:



> PlaySound App.Path & "\Audio.WAV", ByVal 0&, SND_ASYNC

----------

