Reading keyboard/keys state in Win XP

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Reading keyboard/keys state in Win XP

John Pote
I'm currently working on a wrapper program to help test a controller
task/module for a  keypad/LCD display module that is part of an embedded
system. I wish to use the PC's keyboard to substitute for the keypad on
the LCD display module. As part of its operation the controller task
needs to know when a key is pressed, while it is being held down and
when it is released. ie the key state.

Does anyone know how I might be able to read the state of the PC's
keyboard in a program compiled by MinGW so I can get key down and key up
events or just read the state of the keyboard so I can determine key
down and key up events.

Hope someone can help. Thanks for everyones time and effort in keeping
MinGW working and up to date.

John

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Reading keyboard/keys state in Win XP

Eli Zaretskii
> Date: Tue, 17 Mar 2015 23:13:02 +0000
> From: John Pote <[hidden email]>
>
> Does anyone know how I might be able to read the state of the PC's
> keyboard in a program compiled by MinGW so I can get key down and key up
> events or just read the state of the keyboard so I can determine key
> down and key up events.

I think you want GetKeyState, GetAsyncKeyState, and friends.

If you are talking about a console program, then ReadConsoleInput
might also be relevant.

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Reading keyboard/keys state in Win XP

John Pote


On 18/03/2015 16:21, Eli Zaretskii wrote:

>> Date: Tue, 17 Mar 2015 23:13:02 +0000
>> From: John Pote <[hidden email]>
>>
>> Does anyone know how I might be able to read the state of the PC's
>> keyboard in a program compiled by MinGW so I can get key down and key up
>> events or just read the state of the keyboard so I can determine key
>> down and key up events.
> I think you want GetKeyState, GetAsyncKeyState, and friends.
>
> If you are talking about a console program, then ReadConsoleInput
> might also be relevant.
>
Thanks for the reply. Compiler found and linked the function without
needing to do anything so I'll be able to do what I want to now.

Many thanks,
John

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe