hiii

I have a console window . how can i get the pressed keys . for an example : if the user pressed ctrl . how do i know which key has been pressed (in console window)


eko
Posted on 2001-08-20 10:20:46 by eko
eko,

what do you mean about 'console window' ?

In windows, to get a key, you just have to check for a WM_KEYDOWN message.
Posted on 2001-08-21 06:36:53 by Bit7
yeah i know this ..
but i'm talking here on a console windows. like command.com , cmd.exe
how do i know when the user pressed ctrl,tab or any other key
?
Posted on 2001-08-21 06:54:39 by eko
Hi eko about your console window,

i don't know how i could help you,
but I'd like to ask you a favour,

does your console work fine ?
if yes could you maybe post your code ?
cuz mine just shows up, dissapears and the program crashes
Posted on 2001-08-21 09:15:09 by Olli
Does this help?
Posted on 2001-08-21 09:26:47 by KetilO
hi
i allready saw it ,. it does not have what i looking for .

how do i know when the user pressed on a key in the keyboard like the enter key or the tab.




eko
Posted on 2001-08-21 09:42:27 by eko
her are some functions related to the console API:

GetNumberOfConsoleInputEvents
PeekConsoleInput
ReadConsole
ReadConsoleInput
SetConsoleMode

with ReadConsoleInput you get a character typed in by the user. If you dont want to poll the console, you will need to use WaitForSingleObject or another wait function.

japheth
Posted on 2001-08-21 09:53:30 by japheth
thanks :alright:

i'll give it a try

eko
Posted on 2001-08-21 10:06:03 by eko