Thread: PlaySound doesn't play when called!

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Feb 2006
    Posts
    71

    help

    I've been trying to make a program play sound =/ but i get a linker error and an exit 1 error with this as my playsound function:
    Code:
        PlaySound("c:\\documents and settings\\...\\shared\\Battlefeild.mp3",(HMODULE)HMOD,SND_LOOP);
    is HMOD just a handle for the song thats going to be played? and can it be any format? or does it have to be a .wav =/

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    You could always RTFM...

    MSDN
    HMOD "This parameter must be NULL unless SND_RESOURCE is specified in fdwSound. "

    If using a file make sure you use the SND_FILENAME flag (and have spelled the path correctly (BattleField or BattleFeild?)

    Make sure you have linked to Winmm.lib and included windows.h

    AFAIK it has to be a .wav file

    ie

    iReturn = PlaySound("c:\\documents and settings\\...\\shared\\Battlefeild.mp3",NULL,SND_L OOP | SND_RESOURCE | SND_ASYNC);
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. PlaySound() laggage...
    By cobrasniper555 in forum Windows Programming
    Replies: 1
    Last Post: 07-22-2006, 12:43 AM
  2. Replies: 6
    Last Post: 04-21-2006, 08:49 PM
  3. How to play sound from a resource?
    By Digga in forum Windows Programming
    Replies: 6
    Last Post: 06-08-2005, 06:35 PM
  4. PlaySound function
    By GaPe in forum Windows Programming
    Replies: 8
    Last Post: 10-20-2003, 06:20 PM
  5. Gui Class With Tic Tac Toe
    By xxYukoxx in forum C++ Programming
    Replies: 1
    Last Post: 06-01-2003, 04:28 PM