Hi, I`m new here and, of course, have a small problem.
I need to create a program with VC++ 6 Builder where:
Press ENTER once - open picture,
Press ENTER Twice - start a music.
I can`t figure out how to check if user press ENTER twice, can anybody help me?
You would need to pass into a second control loop. Or have a variable that counts the number of key presses with in that "case". You could have a function with in the case that tests to see if the picture is already open, if TRUE then play music. There are a bunch of ways to do this.
Maybe line 11 should read if (pressCount != 0) Otherwise in this snipit of code I don't see where you declared "count" as a variable.
EDIT: I can't remember if having the ifelse outside of the case statement will mess with your program, I would move it inside if you see anything out of what you expect.
Won't your program always detect the first time you hit the 'enter' key and act accordingly? Think about mouse clicks for a second. The computer won't wait forever to see if you want to click once or twice. It will wait for a set period of time. You should have a time lapse after the first key stroke, after which the computer will process the desired selection. Let me try to explain in pseudocode:
if enter is pressed
start timer
if enter is pressed while timer is running
start music
else
open picture
Or you could just assign different keys to each function.