Click to See Complete Forum and Search --> : sounds in visual c++


freaky
01-17-2001, 08:20 AM
I would like to play a sound when my windows program starts is there can
you help me with this?
you recieve my never ending gratitude for it.

Dean
01-17-2001, 10:08 AM
hiya thanx for trying to help me before, but the c== code u told me did not
compile properly
anyway if u want sounds for windows startup, go to START -> SETTINGS -> CONTROL
PANEL -> SOUNDS, then go to Start Windows and inport your own file there


"freaky" <parretkev@hotmail.com> wrote:
>
>I would like to play a sound when my windows program starts is there can

>you help me with this?
>you recieve my never ending gratitude for it.
>

h
01-17-2001, 02:27 PM
Hi,


Use sndPlaySound


Header: Declared in Mmsystem.h.
Library: Use Winmm.lib.


BOOL sndPlaySound(
LPCSTR lpszSound,
UINT fuSound
);
Parameters
lpszSound
A string that specifies the sound to play. This parameter can be either an
entry in the registry or in WIN.INI that identifies a system sound, or it
can be the name of a waveform-audio file. (If the function does not find
the entry, the parameter is treated as a filename.) If this parameter is
NULL, any currently playing sound is stopped.
fuSound
Flags for playing the sound. The following values are defined. Value Meaning

SND_ASYNC The sound is played asynchronously and the function returns immediately
after beginning the sound. To terminate an asynchronously played sound, call
sndPlaySound with lpszSoundName set to NULL.
SND_LOOP The sound plays repeatedly until sndPlaySound is called again with
the lpszSoundName parameter set to NULL. You must also specify the SND_ASYNC
flag to loop sounds.
SND_MEMORY The parameter specified by lpszSoundName points to an image of
a waveform sound in memory.
SND_NODEFAULT If the sound cannot be found, the function returns silently
without playing the default sound.
SND_NOSTOP If a sound is currently playing, the function immediately returns
FALSE, without playing the requested sound.
SND_SYNC The sound is played synchronously and the function does not return
until the sound ends.


Return Values
Returns TRUE if successful or FALSE otherwise.



"freaky" <parretkev@hotmail.com> wrote:
>
>I would like to play a sound when my windows program starts is there can

>you help me with this?
>you recieve my never ending gratitude for it.
>