Can I access sounds in a sounds folder - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Can I access sounds in a sounds folder

I have been learning to program in Windows using C on a PC running Windows XP and Petzold's Guide to Win32 API.

I wrote some short programs which use calls such as PlaySound (TEXT ("click.wav"), NULL, SND_FILENAME | SND_ASYNC) ; to play the sounds. All worked well.

However I decided to tidy up the sounds by placing them inside a folder called 'sounds'. I then called them using calls such as PlaySound (TEXT ("Sounds/click.wav"), NULL, SND_FILENAME | SND_ASYNC) ;

Again all worked well on Windows XP. However, I am a teacher, and at school we use Windows 92 and 98. On 95 and 98 the call to PlaySound produces silence unless I remove the sounds from the sounds folder and keep them beside the application.

It really does look better to keep all the sounds inside a sound folder. Is there any way that I can do that and have this work in XP and earlier OS?

Comments

  • pingpongpingpong Posts: 937Member
    Maybe
    PlaySound (TEXT ("Sounds\click.wav"), NULL, SND_FILENAME | SND_ASYNC) ;
    ?
    If you are at the Sounds folder the above should work.

    : I have been learning to program in Windows using C on a PC running Windows XP and Petzold's Guide to Win32 API.
    :
    : I wrote some short programs which use calls such as PlaySound (TEXT ("click.wav"), NULL, SND_FILENAME | SND_ASYNC) ; to play the sounds. All worked well.
    :
    : However I decided to tidy up the sounds by placing them inside a folder called 'sounds'. I then called them using calls such as PlaySound (TEXT ("Sounds/click.wav"), NULL, SND_FILENAME | SND_ASYNC) ;
    :
    : Again all worked well on Windows XP. However, I am a teacher, and at school we use Windows 92 and 98. On 95 and 98 the call to PlaySound produces silence unless I remove the sounds from the sounds folder and keep them beside the application.
    :
    : It really does look better to keep all the sounds inside a sound folder. Is there any way that I can do that and have this work in XP and earlier OS?
    :

  • Bob SomervilleBob Somerville Posts: 13Member
    Thanks. \ worked where / did not. I'll try to wake up!

    : Maybe
    : PlaySound (TEXT ("Sounds\click.wav"), NULL, SND_FILENAME | SND_ASYNC) ;
    : ?
    : If you are at the Sounds folder the above should work.
    :
    : : I have been learning to program in Windows using C on a PC running Windows XP and Petzold's Guide to Win32 API.
    : :
    : : I wrote some short programs which use calls such as PlaySound (TEXT ("click.wav"), NULL, SND_FILENAME | SND_ASYNC) ; to play the sounds. All worked well.
    : :
    : : However I decided to tidy up the sounds by placing them inside a folder called 'sounds'. I then called them using calls such as PlaySound (TEXT ("Sounds/click.wav"), NULL, SND_FILENAME | SND_ASYNC) ;
    : :
    : : Again all worked well on Windows XP. However, I am a teacher, and at school we use Windows 92 and 98. On 95 and 98 the call to PlaySound produces silence unless I remove the sounds from the sounds folder and keep them beside the application.
    : :
    : : It really does look better to keep all the sounds inside a sound folder. Is there any way that I can do that and have this work in XP and earlier OS?
    : :
    :
    :

Sign In or Register to comment.