Click to See Complete Forum and Search --> : Sound Enabling
m i k e l
Dec 1st, 1999, 06:14 AM
Hello
I am looking for the required OCX/DLL to enable a sound player to my program (ie: Goto your Control Panel/Sounds). The play and stop function is what I am in search for. Any help would be appreciated, thank you
mikel
chrisjk
Dec 1st, 1999, 08:13 AM
Look through the BB archives, it's the kind of question that appears all the time. In reply, here is some code I got from Serge's post
Private Declare Function sndPlaySound Lib "WinMM.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Private Const SND_ASYNC = &H1
Private Const SND_NODEFAULT = &H2
Private Const SND_FLAG = SND_ASYNC Or SND_NODEFAULT
Public Sub PlayWav(pWavFile As String)
If Dir(pWavFile) <> "" Then
Call sndPlaySound(pWavFile, SND_FLAG)
End If
End Sub
Place this code on your button to play wav
PlayWav "C:\Mysound.wav"
If your looking for a console-based player (with buttons and length etc), use the Windows Media Player control.
Regards,
------------------
- Chris
chris.kilhams@btinternet.com
If it ain't broke - don't fix it :)
[This message has been edited by chrisjk (edited 12-01-1999).]
m i k e l
Dec 2nd, 1999, 02:07 AM
But what about a stop command?
Aaron Young
Dec 2nd, 1999, 02:12 AM
Call the Function Again using the SND_PURGE Flag:
Private Const SND_PURGE = &H40
------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
adyoung@win.bright.net
m i k e l
Dec 2nd, 1999, 04:28 AM
Thank you, both of you
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.