|
-
Jan 6th, 2000, 06:26 PM
#1
How do you play a wav sound that is embeded in a resource file? (And how do you stop it playing!!)
I'd rather not have to save it to disk first, if at all possible.
------------------
Matthew Ralston
E-Mail: [email protected]
ICQ:31422892
Web Sites:The Blue Link My Home Page (Not up at the moment!)
-
Jan 6th, 2000, 08:09 PM
#2
Doesn't matter, I've figured it out myself...
------------------
Matthew Ralston
E-Mail: [email protected]
ICQ:31422892
Web Sites:The Blue Link My Home Page (Not up at the moment!)
-
Jan 6th, 2000, 08:52 PM
#3
-
Jan 6th, 2000, 11:58 PM
#4
Mark Sreeves Analyst Programer Softlab A BMW Group Company not know this?
Is your job title as cool as it sounds? Or is it just a great name for a boring overated job?
Nuf chat...
Resource file compiled with vb app, wave sound to play has a resource id string of 101...
Code:
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 FLAGS = SND_ASYNC And SND_NODEFAULT
Public Sub PlayWavResource(pintResourceID As Integer)
Dim bytArr() As Byte
Dim intFFN As Integer
Dim strPath As String
bytArr = LoadResData(pintResourceID, "CUSTOM")
strPath = App.Path & IIf(Right(App.Path, 1) = "\", "~tempwav.wav", "\~tempwav.wav")
intFFN = FreeFile
Open strPath For Binary As intFFN
Put #intFFN, , bytArr
Close #intFFN
Call sndPlaySound(strPath, FLAGS)
Kill strPath
End Sub
Unfortuantely it does copy the wave to a temp file first, we'll just have to put up with it... 
------------------
Matthew Ralston
E-Mail: [email protected]
ICQ:31422892
Web Sites:The Blue Link My Home Page (Not up at the moment!)
[This message has been edited by matthewralston (edited 01-07-2000).]
-
Jan 7th, 2000, 12:42 PM
#5
Not exactly:
Code:
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 FLAGS = SND_ASYNC And SND_NODEFAULT
Public Sub PlayWavResource(pintResourceID As Integer)
Dim bytArr() As Byte
Dim intFFN As Integer
Dim strPath As String
bytArr = LoadResData(pintResourceID, "CUSTOM")
Call sndPlaySound(StrConv(bytArr, vbUnicode), FLAGS)
End Sub
------------------
Serge
Software Developer
[email protected]
ICQ#: 51055819
-
Jan 7th, 2000, 12:50 PM
#6
Cool!
------------------
Matthew Ralston
E-Mail: [email protected]
ICQ:31422892
Web Sites:The Blue Link My Home Page (Not up at the moment!)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|