Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

kbhit equivalent

39 views
Skip to first unread message

Patrick Ribault

unread,
Jul 2, 2007, 6:24:04 PM7/2/07
to
I found this question a lot of time on google, but I never find the answer.

On WCE 5.0 & VS2005 I need to ckeck for keypressed in a console application.
On Windows and Linux (my application is cross platform compliant) I'm using

if (_kbhit())
_getch ();

Do you know how can I get it working on WCE ?

Thank you
Patrick

voidcoder

unread,
Jul 2, 2007, 6:48:47 PM7/2/07
to

Riki

unread,
Jul 2, 2007, 7:00:10 PM7/2/07
to
GetKeyState or GetAsyncKeyState

http://msdn2.microsoft.com/en-us/library/aa453132.aspx
http://msdn2.microsoft.com/en-us/library/ms929204.aspx

riki

--
ThemeChanger and AbstractStart for Smartphone :
http://www.IfIHadADollarForEveryTimeSomeoneSaidThatIWouldHaveMyOwnWebsite.com/
Windows CE Base Team Blog:
http://blogs.msdn.com/ce_base/

"...You can't lie in front of the buldozer indefinately" "I'm game..."

rjb_uk

unread,
Jul 17, 2007, 3:32:29 AM7/17/07
to
I have the same question as Patrick,

GetKeyState()
GetAsyncKeyState()

These functions don't tell me if getch() will block when I call it. I wan't
to port code like this.. which is not possible using the above functions.

while(something)
{
if(kbhit())
{
key = getch();
do somthing
}
}

Paul G. Tobey [eMVP]

unread,
Jul 17, 2007, 12:29:18 PM7/17/07
to
You'll have to change how you think about that sort of code; what you have
there does not port to Windows CE. You might create a window-based
application and do your something as a result of WM_CHAR arriving, I guess.

Paul T.

"rjb_uk" <rjb...@discussions.microsoft.com> wrote in message
news:8BE9CF1F-7C82-43D0...@microsoft.com...

Patrick Ribault

unread,
Aug 5, 2007, 7:45:10 PM8/5/07
to
If you're in console mode (as I'm) it looks like there is no equivalent.

Patrick.

"rjb_uk" <rjb...@discussions.microsoft.com> a écrit dans le message de
news:8BE9CF1F-7C82-43D0...@microsoft.com...

Patrick Ribault

unread,
Aug 28, 2007, 5:09:06 PM8/28/07
to
Well, how to to catch WM_CHAR in a console application :)

PR

Paul G. Tobey [eMVP]

unread,
Aug 28, 2007, 5:21:27 PM8/28/07
to
As I said, "create a window-based application and do your something as a
result of WM_CHAR arriving". I can't think of any way to receive a WM_CHAR
that you're sure will be directed to you, other than to have a window and
use WM_CHAR message processing in it. You could use a low-level keyboard
hook to see all keys pressed, but some of those would likely not be targeted
at you and figuring out which was which might be more trouble than it's
worth.

Paul T.

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:ubNAV%23IyHH...@TK2MSFTNGP06.phx.gbl...

malielec

unread,
May 24, 2010, 4:18:27 AM5/24/10
to

GeyKeyState() does not take 0 argument. i want to take the information about if there is any keyboard input. instead of _kbhit() what can i use???

rjb_u wrote:

I have the same question as Patrick,GetKeyState() GetAsyncKeyState()These

17-Jul-07

GetKeyState()
GetAsyncKeyState()

Previous Posts In This Thread:

On Monday, July 02, 2007 6:24 PM
Patrick Ribault wrote:

kbhit equivalent


I found this question a lot of time on google, but I never find the answer.

On WCE 5.0 & VS2005 I need to ckeck for keypressed in a console application.
On Windows and Linux (my application is cross platform compliant) I'm using

if (_kbhit())
_getch ();

Do you know how can I get it working on WCE ?

Thank you
Patrick

On Monday, July 02, 2007 6:48 PM
voidcoder wrote:

Re: kbhit equivalent
GetKeyState()

http://msdn2.microsoft.com/en-us/library/aa453132.aspx

Patrick Ribault wrote:

On Monday, July 02, 2007 7:00 PM
Riki wrote:

Re: kbhit equivalent


Patrick Ribault wrote:
GetKeyState or GetAsyncKeyState

http://msdn2.microsoft.com/en-us/library/aa453132.aspx
http://msdn2.microsoft.com/en-us/library/ms929204.aspx

riki

--
ThemeChanger and AbstractStart for Smartphone :
http://www.IfIHadADollarForEveryTimeSomeoneSaidThatIWouldHaveMyOwnWebsite.com/
Windows CE Base Team Blog:
http://blogs.msdn.com/ce_base/

"...You can't lie in front of the buldozer indefinately" "I'm game..."

On Tuesday, July 17, 2007 3:32 AM
rjb_u wrote:

GetKeyState()
GetAsyncKeyState()

On Tuesday, July 17, 2007 12:29 PM


Paul G. Tobey [eMVP] wrote:

You'll have to change how you think about that sort of code; what you have
You'll have to change how you think about that sort of code; what you have
there does not port to Windows CE. You might create a window-based
application and do your something as a result of WM_CHAR arriving, I guess.

Paul T.

"rjb_uk" <rjb...@discussions.microsoft.com> wrote in message
news:8BE9CF1F-7C82-43D0...@microsoft.com...

On Sunday, August 05, 2007 7:45 PM
Patrick Ribault wrote:

If you're in console mode (as I'm) it looks like there is no equivalent.

If you are in console mode (as I am) it looks like there is no equivalent.

Patrick.

On Tuesday, August 28, 2007 5:09 PM
Patrick Ribault wrote:

Re: kbhit equivalent


Well, how to to catch WM_CHAR in a console application :)

PR

On Tuesday, August 28, 2007 5:21 PM


Paul G. Tobey [eMVP] wrote:

As I said, "create a window-based application and do your something as a
As I said, "create a window-based application and do your something as a
result of WM_CHAR arriving". I can't think of any way to receive a WM_CHAR
that you're sure will be directed to you, other than to have a window and
use WM_CHAR message processing in it. You could use a low-level keyboard
hook to see all keys pressed, but some of those would likely not be targeted
at you and figuring out which was which might be more trouble than it's
worth.

Paul T.

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:ubNAV%23IyHH...@TK2MSFTNGP06.phx.gbl...


Submitted via EggHeadCafe - Software Developer Portal of Choice
Producer/Consumer Queue and BlockingCollection in C# 4.0
http://www.eggheadcafe.com/tutorials/aspnet/7d10d73c-321c-446e-8b6d-b81ee8d9b314/producerconsumer-queue-a.aspx

0 new messages