RE: background music
Jul 31, 2001 10:50 PDT
I think I tried this before when my brain was smaller (much smaller in
fact) and it didn't work - probably your fault - couldn't possibly be
mine - couldn't possibly - refuse to believe it - refuse - ummm - lost
my thread - so - I'll try again and this time I'll use both my eyes and
most of my brain.
Thanks very much and I'll inform you and grovel humbly in due time -
Only 3 words in English end with "gry". Angry, hungry - that's 2.
What's the third. I don't know the answer but its been bugging me for a
while. Just thought I'd throw that in.
| ||I'm sure the Playsound API function would be the solution since it has |
an argument that specifies whether the file is to be played
asynchronously <-(thank you spell checker!)
I hacked this snippet out of API Guide
'look for application specific association
Private Const SND_APPLICATION = &H80
'name is a WIN.INI [sounds] entry
Private Const SND_ALIAS = &H10000
'name is a WIN.INI [sounds] entry identifier
Private Const SND_ALIAS_ID = &H110000
Private Const SND_ASYNC = &H1
'name is a file name
Private Const SND_FILENAME = &H20000
'loop the sound until next sndPlaySound
Private Const SND_LOOP = &H8
'lpszSoundName points to a memory file
Private Const SND_MEMORY = &H4
'silence not default, if sound not found
Private Const SND_NODEFAULT = &H2
'don't stop any currently playing sound
Private Const SND_NOSTOP = &H10
'don't wait if the driver is busy
Private Const SND_NOWAIT = &H2000
'purge non-static events for task
Private Const SND_PURGE = &H40
'name is a resource name or atom
Private Const SND_RESOURCE = &H40004
'play synchronously (this is the default if not specified)
Private Const SND_SYNC = &H0
Private Declare Function PlaySound Lib "winmm.dll" _
Alias "PlaySoundA" ( _
ByVal lpszName As String, _
ByVal hModule As Long, _
ByVal dwFlags As Long _
) As Long
Private Sub Form_Load()
PlaySound "C:\WINDOWS\MEDIA\TADA.WAV", _
ByVal 0&, SND_FILENAME Or SND_ASYNC
Phil McCarthy wrote:
| ||Anybody got any advice on background music - err - not what to play - |
more a case of how to play it.
If I use play sound then it calls a .wav file and nothing much happens
until that sound has finished playing - which ain't much use to me.
So, I figure I'm missing some sort of thing there - like a brain and a
spot of code.
I have this cunning plan where I shell (why is it called shell) the
music file and thus it plays away in the background as an associate.
I'll think of some other questions soon ...
The reasonable man adapts himself to the world;
the unreasonable man persists in trying to adapt
the world to himself.
Therefore, all progress depends on the