dears
I have CODEBLOCKS and I need an example to read from keyboard without waiting, the program will continue without waiting the key to be pressed and if any key was pressed it will store the code to be checked Latter.
thanks
Fariz
get key
Page 1 of 13 Replies - 270 Views - Last Post: 28 August 2011 - 12:39 AM
Replies To: get key
#3
Re: get key
Posted 27 August 2011 - 07:20 PM
MS Windows uses a WINPROC() method (that you create)
that holds input for you, but can be checked at any time.
You would start a HWND, and pass a WINPROC function that you write.
Your WINPROC just looks at what it receives, because it only gets called when you pass the HINSTANCE input to its parent HWND.
GetKeyboardState is really awesome, you can grab the entire keyboard in one pass with a 256 byte array, but it's not as fast as GetAsyncKeyState, and you don't know the capture rate. (or the time it was captured)
conio has getch(), but please don't use it, it's ra-heely depreciated, and only works with a console. It only waits for one key, return counts as one, but I don't know why I wrote this here. I guess I just had the space to write about getch()?
that holds input for you, but can be checked at any time.
You would start a HWND, and pass a WINPROC function that you write.
Your WINPROC just looks at what it receives, because it only gets called when you pass the HINSTANCE input to its parent HWND.
GetKeyboardState is really awesome, you can grab the entire keyboard in one pass with a 256 byte array, but it's not as fast as GetAsyncKeyState, and you don't know the capture rate. (or the time it was captured)
conio has getch(), but please don't use it, it's ra-heely depreciated, and only works with a console. It only waits for one key, return counts as one, but I don't know why I wrote this here. I guess I just had the space to write about getch()?
#4
Re: get key
Posted 28 August 2011 - 12:39 AM
Speaking of conio.h, conio.h also has _kbhit() which checks if, well, the keyboard was hit.
I do not recommend usage of this though as it lies in conio.h and conio.h is non-standard.
I do not recommend usage of this though as it lies in conio.h and conio.h is non-standard.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote






|