hello
How to stop a wavefile thats running. i want to have it through menu operation. like file -- stopplay. and as soon as i click on stopplay it will stop playing the running wavefile...
any ideas??
radhika
Printable View
hello
How to stop a wavefile thats running. i want to have it through menu operation. like file -- stopplay. and as soon as i click on stopplay it will stop playing the running wavefile...
any ideas??
radhika
VB Code:
Option ExplicitOption Explicit Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long Const SND_APPLICATION = &H80 ' look for application specific association Const SND_ALIAS = &H10000 ' name is a WIN.INI [sounds] entry Const SND_ALIAS_ID = &H110000 ' name is a WIN.INI [sounds] entry identifier Const SND_ASYNC = &H1 ' play asynchronously Const SND_FILENAME = &H20000 ' name is a file name Const SND_LOOP = &H8 ' loop the sound until next sndPlaySound Const SND_MEMORY = &H4 ' lpszSoundName points to a memory file Const SND_NODEFAULT = &H2 ' silence not default, if sound not found Const SND_NOSTOP = &H10 ' don't stop any currently playing sound Const SND_NOWAIT = &H2000 ' don't wait if the driver is busy Const SND_PURGE = &H40 ' purge non-static events for task Const SND_RESOURCE = &H40004 ' name is a resource name or atom Const SND_SYNC = &H0 ' play synchronously (default) Dim strFileName As String Private Sub cmdPlay_Click() strFileName = "C:\WINNT\Media\Windows Logon Sound.wav" PlaySound strFileName, ByVal 0&, SND_FILENAME Or SND_ASYNC End Sub Private Sub cmdStop_Click() strFileName = vbNullString PlaySound strFileName, ByVal 0&, SND_PURGE End Sub
Or you can use the Windows Media Control