Thread: How would you due this

  1. #1
    Registered User
    Join Date
    Apr 2009
    Posts
    1

    How would you due this

    I am complete new to programming and I would like to write a program that when F12 is pushed on the keyboard a sound clip will play. What I would like to know is if this is possible using C++ or if another language would be better and how simple it would be. Lastly where should I start? I have been doing some searching around and wrote some “hello world” type stuff but I am a bit confused as to what the next step would be.

  2. #2
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Of course its possible in C++ or another language. What sort of question is that?

    Why don't you show us what you have tried and we will tell you where to go from there.

  3. #3
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    2,158
    Well, what you want isn't a console program anymore.

    First, you need to really know how to use the language. Just because you made a Hello World app doesn't mean you really know how to program. Takes some tuts or get a book if you're not already.
    Second, you need to read up on and familiarize yourself with the Win32 API.

    From there, it should be pretty easy to figure it out. If you still have problems, post it. (And your code)

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    In WIN32 the OS tells you that an event has occurred (F12 pressed).

    You need to 'handle' the key press and in response play the sound.

    Read up on WM_KEYDOWN, WM_CHAR etc. to find out how to create the message 'handler' in the 'callback' function.

    PlaySound() is prob the easiest to use.
    "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. This may be due to a corruption of the heap
    By krishnampkkm in forum C++ Programming
    Replies: 4
    Last Post: 06-26-2009, 03:19 AM
  2. Replies: 2
    Last Post: 01-31-2008, 09:52 AM
  3. Help Someone! First program/errors and its due tonight!
    By LittleLotte in forum C Programming
    Replies: 4
    Last Post: 02-02-2005, 09:21 AM
  4. How often do you lose sleep due to programming
    By Thantos in forum A Brief History of Cprogramming.com
    Replies: 21
    Last Post: 08-26-2003, 12:10 AM
  5. need help with assignment due tonite
    By puckett_m in forum C Programming
    Replies: 4
    Last Post: 10-25-2001, 02:29 PM