|
|
Home » Extra libraries, Code snippets, applications etc. » C++ language problems and code snippets » Detect when a key is pressed!
Detect when a key is pressed! [message #6942] |
Tue, 05 December 2006 15:23  |
_Seven_
Messages: 35 Registered: April 2006
|
Member |
|
|
Hi all! I'm doing a program that simulates a piano, doing beeps with diferent frequency depending of the key that is pressed. I have a table with the diferente notes and i do the follow code:
int aux;
int note[]={....}//contain the notes
while(aux!=57){ //create a cicle until aux different of 9, "9"==59
if(_conio_kbhit()){
aux=getch();
SetSound(note[aux-49]); //aux receive a number between 0-9
} //but it is in char. "1" is the
//number 49 char
}
this create a beep! but i want some function that when i press a key the beep is continuous and lasts until the key is not pressed.
I'm use gcc to compile. Thanks for your attention
|
|
|
|
|
Re: Detect when a key is pressed! [message #29384 is a reply to message #29383] |
Sun, 17 October 2010 12:33   |
|
koldo wrote on Sun, 17 October 2010 10:52 | Hello Seven
I do not remember to do it in a command line program, but if you want to do it in a GUI program including keyboard we can help you.
|
Hi Koldo,
Svens message is 4 years old, I don't think he expects answer Also kryolit0 seems to be a spambot... Or a rude person, but I prefer the bot 
Honza
|
|
|
|
Re: Detect when a key is pressed! [message #29386 is a reply to message #29385] |
Sun, 17 October 2010 14:56   |
|
Hi Jerson,
There used to be very little spammers on this forum for a long time. It is only last few months that they appear frequently. There was never any need to moderate anything (no flames, no trolls ), but the spam is irritating me too...
I believe there are ways to control that, using the forum capabilities. Koldo should even have rights for that (right, Koldo?). The trouble is that the posts are well targeted and can often deceive the humans (Does that mean they are going to pass Turing test soon? )
Anyway, for short: I believe we should take the little extra time and delete spammers posts and accounts.
Honza
|
|
|
Re: Detect when a key is pressed! [message #29387 is a reply to message #29386] |
Sun, 17 October 2010 16:20   |
 |
koldo
Messages: 3432 Registered: August 2008
|
Senior Veteran |
|
|
Sorry all
The desire to help was greater than checking original message date and Mr. Kryolite signature link .
If you want to see the importance of new users banned, see here:
New users Banned
July 23 3
August 24 9
September 12 2
October (prov) 11 2
They are not too much, they are not too aggressive and they are detected immediately so I would not moderate them.
Best regards
Iñaki
[Updated on: Sun, 17 October 2010 16:30] Report message to a moderator
|
|
|
|
|
Re: Detect when a key is pressed! [message #29557 is a reply to message #6942] |
Fri, 29 October 2010 10:01  |
mr_ped
Messages: 826 Registered: November 2005 Location: Czech Republic - Praha
|
Experienced Contributor |
|
|
I think the limit is impossible to define mathematically.
I would permit even carpet shop, if it would be you, because the link in signature is extremely unobtrusive (you don't have to click it, if you want, and if it says "my carpet shop", I will simply not click it unless I'm interested into carpets).
It would be you taking advantage of U++ forums, but so what? You are active U++ member doing lot of good for U++, so why can't U++ do this little bit of good for you back? I think that would be ok.
I'm maybe too permissive in this, but it feels to me sort of BSDish this way. 
I would not find this ok with people who don't contribute, write just 1-2 posts with as much value as "Hey, I'm using this solution too, thank you!", and put the link into signature. Those should buy ads.
And this shows I'm more GPLed, then BSDish, requiring people to give back, not just to take away...
Hehe, confusing stuff. I think the best thing is to mark offending posts and let administrators to decide. If somebody objects his link was removed, he can start the discussion, and we can take closer look then. I think this way only very little damage will be done, and we will catch most of the disgusting cases of pure abuse of situation (which I don't like).
|
|
|
Goto Forum:
Current Time: Sat Apr 26 18:20:54 CEST 2025
Total time taken to generate the page: 0.01052 seconds
|
|
|