Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Res File

Posted on 2000-03-07
2
Medium Priority
?
183 Views
Last Modified: 2010-05-02
How to play a wav from res file?
0
Comment
Question by:EasyCoder
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 13

Accepted Solution

by:
crazyman earned 600 total points
ID: 2592015
#If Win32 Then
Private Declare Function sndPlaySound Lib "winmm" Alias _
   "sndPlaySoundA" (lpszSoundName As Any, ByVal uFlags As Long) _
   As Long
#Else
Private Declare Function sndPlaySound Lib "MMSYSTEM" ( _
                   lpszSoundName As Any, ByVal uFlags%) As Integer
#End If

' Flag values for wFlags parameter.

'*********************************************************************

Public Const SND_SYNC = &H0        ' Play synchronously (default).
'Public Const SND_ASYNC = &H1      ' Play asynchronously (see
                            ' note below).
Public Const SND_NODEFAULT = &H2   ' Do not use default sound.
Public Const SND_MEMORY = &H4      ' lpszSoundName points to a
                            ' memory file.
Public Const SND_LOOP = &H8        ' Loop the sound until next
                            ' sndPlaySound.
Public Const SND_NOSTOP = &H10     ' Do not stop any currently
                                                  ' playing sound.
Public Sub PlayWaveRes(vntResourceID As Variant, Optional vntFlags)
'-----------------------------------------------------------------
' WARNING:  If you want to play sound files asynchronously in
'           Win32, then you MUST change bytSound() from a local
'           variable to a module-level or static variable. Doing
'           this prevents your array from being destroyed before
'           sndPlaySound is complete. If you fail to do this, you
'           will pass an invalid memory pointer, which will cause
'           a GPF in the Multimedia Control Interface (MCI).
'-----------------------------------------------------------------
Dim bytSound() As Byte ' Always store binary data in byte arrays!

bytSound = LoadResData(vntResourceID, "WAVE")

If IsMissing(vntFlags) Then
   vntFlags = SND_NODEFAULT Or SND_SYNC Or SND_MEMORY
End If

If (vntFlags And SND_MEMORY) = 0 Then
   vntFlags = vntFlags Or SND_MEMORY
End If

sndPlaySound bytSound(0), vntFlags
               End Sub
0
 

Author Comment

by:EasyCoder
ID: 2592025
Wow Fast ..thanks
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question