Thread: Why the *BEEP* doesn't this work?

  1. #1
    Registered Usurer
    Join Date
    Apr 2005
    Location
    upstate NY
    Posts
    79

    Why the *BEEP* doesn't this work?

    I'm trying to get some sound going besides "/a", and my searching has led me to the beep command in windows.h.

    What am I doing wrong here?

    Code:
    #include <windows.h>
    
    int main()
    {
        beep(440, 100);
        return 0;
    }
    I'm sure it's obvious, but I'm a real n00b and barely know what I'm doing - thanks for the help.

    -JM

  2. #2
    Banned
    Join Date
    Jun 2005
    Posts
    594
    you have to remember c++
    is case sensitive try Beep();

  3. #3
    Registered Usurer
    Join Date
    Apr 2005
    Location
    upstate NY
    Posts
    79

    Talking

    Hey, that was it, thanks!

    Here's some cheezy sounding Beethoven:

    Code:
    #include <windows.h>
    
    int main()
    {
        Beep(1568, 200);
        Beep(1568, 200);
        Beep(1568, 200);
        Beep(1245, 1000);
        Beep(1397, 200);
        Beep(1397, 200);
        Beep(1397, 200);
        Beep(1175, 1000);
        
        return 0;
    }
    Last edited by -JM; 07-26-2005 at 03:00 PM.

  4. #4
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    Beep() is a screwy function with a lot of "ifs"...

    I think it works like this...

    If you have Windows NT, 2000, or XP, it will work as expected, playing the frequency & duration through the computer's internal speaker.

    If you don't have a soundcard, and you have Windows ME, 98, or 95, it will ignore the frequency & duration paramaters, and play a beep through the internal speaker.

    If you have a soundcard and Windows ME, 98, or 95, it plays the Windows default sound through the external speakers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. strcmp returning 1...
    By Axel in forum C Programming
    Replies: 12
    Last Post: 09-08-2006, 07:48 PM
  2. getline() don't want to work anymore...
    By mikahell in forum C++ Programming
    Replies: 7
    Last Post: 07-31-2006, 10:50 AM
  3. Why don't the tutorials on this site work on my computer?
    By jsrig88 in forum C++ Programming
    Replies: 3
    Last Post: 05-15-2006, 10:39 PM
  4. fopen();
    By GanglyLamb in forum C Programming
    Replies: 8
    Last Post: 11-03-2002, 12:39 PM
  5. DLL __cdecl doesnt seem to work?
    By Xei in forum C++ Programming
    Replies: 6
    Last Post: 08-21-2002, 04:36 PM