views:

42

answers:

1

Hello i am having trouble utilising the repeat count parameter of the msg WM_KEYDOWN ... using visual c++ 2008 for some reason or the other the repeat count of the msg does not increment if the key is held for long.... for eg if i use this code::

----------

*TextOut(hdc,cxChar*2*(sizeof(szBuffer)/sizeof(TCHAR)),i*cyChar,szBuffer,wsprintf(szBuffer,"%i",LOWORD(lParam)));*

the output on the screen is always a series of 1s... even if i havent released the key... Please help me out

A: 

The repeat count is not cumulative according to MSDN:

The repeat count for the current message. The value is the number of times the keystroke is autorepeated as a result of the user holding down the key. If the keystroke is held long enough, multiple messages are sent. However, the repeat count is not cumulative.

So probably multiple WM_KEYDOWN message is generated.

Donotalo
so how do i make use of the repeat count?? what purpose does it serve then? and how do i stop windows from sending multiple WM_KEYDOWN messages??
vinayak
the documentation says: "If the keystroke is held long enough". that means, you can still use the repeat count if the key is released before "long enough" time has elapsed. not sure what is the time interval for "long enough" here. i never used repeat count. the doc also says, "The previous key state (bit 30) can be used to determine whether the WM_KEYDOWN message indicates the first down transition or a repeated down transition". i'm not sure if you can stop windows sending multiple messages. if you want to ignore some message, don't process it.
Donotalo
so if i have to accelerate something i cannot do it based on the repeat count ... the longer the key is held more should be its acceleration ...
vinayak
yep, according to my knowledge. you should accelerate until key is released.
Donotalo