Sunday, July 26, 2009

Is there a library header file i can download for C++, that will give me KeyHandling procedures.?

I want to ba able to detect key presses during runtime without the stoping the flow of execution. For e.g. "std::cout", waits for the user's input, and then the user has to press enter to register their input. I know that the standerd ANSI C++ library doesn't support the features what i'm looking for. Is it possible to download an external libarry with keyhandling procedures. If you know of any, please let me know. Also when adding external libraries to your sorce code, is it ok to just add the header file #include%26lt;somthing%26gt; or do u have to change some of the linker settings. I'm using visual C++ 2005 express edition if thats any help.

Is there a library header file i can download for C++, that will give me KeyHandling procedures.?
Actually, it is all built into existing libraries you already have.





Do a search in the help section of your tool for "_kbhit". It will give you a code snippet so that you can see how it works. You have to set up your own polling mechanism to wait for a keystroke but you can do a lot of other processing and then periodically check for a keystroke. It uses %26lt;conio.h%26gt;.





Alternatively if you are doing "forms" programing then you will want to use a keyboard control. You can read all about it in the help section. I did not spend much time looking but I'm sure you can find a code snippet there too.





Good luck!


No comments:

Post a Comment