Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to next message
_Seven_ is currently offline  _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 #29382 is a reply to message #6942] Sun, 17 October 2010 07:14 Go to previous messageGo to next message
unknown user
Your code is completely wrong. But don't ask why.
Re: Detect when a key is pressed! [message #29383 is a reply to message #6942] Sun, 17 October 2010 10:52 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 2919
Registered: August 2008
Veteran
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.


Best regards
Iñaki
Re: Detect when a key is pressed! [message #29384 is a reply to message #29383] Sun, 17 October 2010 12:33 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1756
Registered: August 2008
Location: Czech Republic
Senior Contributor

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 Wink Also kryolit0 seems to be a spambot... Or a rude person, but I prefer the bot Smile

Honza
Re: Detect when a key is pressed! [message #29385 is a reply to message #6942] Sun, 17 October 2010 14:04 Go to previous messageGo to next message
jerson is currently offline  jerson
Messages: 200
Registered: June 2010
Location: Bombay, India
Experienced Member

Hi Honza, Koldo

I saw that message and thought it would be deleted by a moderator and maybe ban the user as well. The fact that spammers consider this a good forum to spam indicates healthy forum activity here.

I wish the first 5 posts of a new user could be moderated so that this kind of spam activity can be eliminated.

Regards
Jerson
Re: Detect when a key is pressed! [message #29386 is a reply to message #29385] Sun, 17 October 2010 14:56 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1756
Registered: August 2008
Location: Czech Republic
Senior Contributor

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 Wink ), 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? Shocked )

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 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 2919
Registered: August 2008
Veteran
Sorry all

The desire to help was greater than checking original message date and Mr. Kryolite signature link Rolling Eyes .

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 #29533 is a reply to message #6942] Wed, 27 October 2010 11:34 Go to previous messageGo to next message
mr_ped is currently offline  mr_ped
Messages: 790
Registered: November 2005
Location: Czech Republic - Praha
Contributor

I think we should remove URL links from people's posts more aggressively when it's low post count member and his posts don't look valuable enough.

I can perfectly accept if somebody like koldo want to promote anything here in this forum, even his own viagra e-shop, because he already proved he's helpful for U++, and I don't see a reason why such people shouldn't be allowed to do some advertising here (in proper forum section).

But the people who just register, post 2-10 almost empty posts, or just vaguely to the topic, and have some URL link in every post which is neither personal or SW-dev related ... remove their links all the time?
Re: Detect when a key is pressed! [message #29535 is a reply to message #29533] Wed, 27 October 2010 16:16 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 2919
Registered: August 2008
Veteran
mr_ped wrote on Wed, 27 October 2010 11:34

I think we should remove URL links from people's posts more aggressively when it's low post count member and his posts don't look valuable enough.

I can perfectly accept if somebody like koldo want to promote anything here in this forum, even his own %%%% e-shop, because he already proved he's helpful for U++, and I don't see a reason why such people shouldn't be allowed to do some advertising here (in proper forum section).

But the people who just register, post 2-10 almost empty posts, or just vaguely to the topic, and have some URL link in every post which is neither personal or SW-dev related ... remove their links all the time?

Hello mr_ped

IMHO It would not have to be accepted direct or indirect advertising of items or services unrelated with U++ from anybody, including me Smile.

Where is the limit IMHO?. Imagine I am proud of my company or organization and I would like to put a link to it in my personal page and signature. Some cases and my opinion about if permitting it:

- A carpet shop: Not permitted
- A video game company: Permitted
- A Boy Scout organization: Not permitted (sorry Rolling Eyes)
- An open source project: Permitted
- My blog: Permitted



Best regards
Iñaki
Re: Detect when a key is pressed! [message #29557 is a reply to message #6942] Fri, 29 October 2010 10:01 Go to previous message
mr_ped is currently offline  mr_ped
Messages: 790
Registered: November 2005
Location: Czech Republic - Praha
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. Smile

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).
Previous Topic: va_list problem
Next Topic: article "Reading C type declarations" for C++ newbies or ignorants like me ;)
Goto Forum:
  


Current Time: Sat Feb 16 16:37:56 CET 2019

Total time taken to generate the page: 0.01010 seconds