Re: WaitForSingleObjectEx() is broken
- From: "hutch--" <hutch@xxxxxxxxx>
- Date: 12 Sep 2005 06:44:42 -0700
smile,
> Heh. You still haven't understood that a keypress generates at least two
> events, and that it's the *user* that isn't fast enough?
And you don't undersand what a keyboard repeat rate is.
This following code proved that WaitForSingleObjectEx() responds at the
keyboard repeat rate. Just press a key and watch it repeat at the
repeat rate.
OPTION PROLOGUE:NONE
OPTION EPILOGUE:NONE
PollForKeyStroke proc keynum:DWORD
push esi
mov esi, rv(GetStdHandle,STD_INPUT_HANDLE)
@@:
invoke FlushConsoleInputBuffer,esi ; clear input buffer
invoke WaitForSingleObjectEx,
esi,INFINITE,0 ; wait for keystroke
print str$(eax),13,10
jmp @B
pop esi
ret
PollForKeyStroke endp
OPTION PROLOGUE:PrologueDef
OPTION EPILOGUE:EpilogueDef
> Why Sleep() when you can block?
It does, it just happens to be ajustable as well and forces a yield.
============================
Whether they're for internal use and should be ignored is irrelevant
here,
they *are* inserted in the console message queue, they *will* trigger
WFSO,
and they *will* show up when you call ReadConsoleInput.
============================
Ah Microsoft, you are wrong again, f0dder has spoken.
> ...and you quietly ignored the MOUSE_EVENT :)
So does WaitForSingleObjectEx(). No mouse movement or button clicking
will trigger WaitForSingleObjectEx(). Try it while
WaitForSingleObjectEx() is waiting and nothing happens. :)
> Also notice that it does not poll _kbhit
Whoever said that it did ? I recommended checking on the code for
_getch instead of some of the crap you have posted.
Regards,
hutch at movsd dot com
.
- Follow-Ups:
- Re: WaitForSingleObjectEx() is broken
- From: f0dder
- Re: WaitForSingleObjectEx() is broken
- References:
- Re: WaitForSingleObjectEx() is broken
- From: Hoogilan
- Re: WaitForSingleObjectEx() is broken
- From: hutch--
- Re: WaitForSingleObjectEx() is broken
- From: Alex McDonald
- Re: WaitForSingleObjectEx() is broken
- From: hutch--
- Re: WaitForSingleObjectEx() is broken
- From: f0dder
- Re: WaitForSingleObjectEx() is broken
- From: f0dder
- Re: WaitForSingleObjectEx() is broken
- From: Alex McDonald
- Re: WaitForSingleObjectEx() is broken
- From: f0dder
- Re: WaitForSingleObjectEx() is broken
- From: hutch--
- Re: WaitForSingleObjectEx() is broken
- From: f0dder
- Re: WaitForSingleObjectEx() is broken
- From: hutch--
- Re: WaitForSingleObjectEx() is broken
- From: f0dder
- Re: WaitForSingleObjectEx() is broken
- From: hutch--
- Re: WaitForSingleObjectEx() is broken
- From: f0dder
- Re: WaitForSingleObjectEx() is broken
- Prev by Date: Re: WaitForSingleObjectEx() is broken
- Next by Date: Re: WaitForSingleObjectEx() is broken
- Previous by thread: Re: WaitForSingleObjectEx() is broken
- Next by thread: Re: WaitForSingleObjectEx() is broken
- Index(es):
Relevant Pages
|