|
-
May 26th, 2005, 09:51 AM
#1
Thread Starter
Member
Setting the Keyboard Delay.
I'm making a test 2D rpg style game. Is there a way to decrease the keyboard delay? I have the directional keys set to WASD. Everything in project to work as it's supposed to, However I don't want that 'second' delay when you hit a key for it to begin repeating.
*EDIT: got it (can't figure out how to delete this thread, maybe because its the first 1)
VB Code:
Private Declare Function SystemParametersInfo Lib "user32" Alias _
"SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, _
ByRef lpvParam As Any, ByVal fuWinIni As Long) As Long
Const SPI_SETKEYBOARDDELAY As Long = 23
Const SPI_SETKEYBOARDSPEED As Long = 11
Const SPIF_SENDWININICHANGE As Long = &H2
Const SPIF_UPDATEINIFILE As Long = &H1
Sub SetKeyboardRepeatInfo(ByVal Delay As Long, ByVal Speed As Long, _
Optional ByVal MakePermanent As Boolean)
Dim flags As Long
' are these changes permanent?
If MakePermanent Then
flags = SPIF_SENDWININICHANGE Or SPIF_UPDATEINIFILE
End If
' set the keyboard delay
SystemParametersInfo SPI_SETKEYBOARDDELAY, Delay, ByVal 0&, flags
' set the keyboard repeat rate
SystemParametersInfo SPI_SETKEYBOARDSPEED, Speed, ByVal 0&, flags
End Sub
' set new values for keyboard speed and delay
'
' DELAY is the timeout after which auto.repeat starts
' can range from 0 (250ms) to 3 (1 sec)
' SPEED is the speed of repeat rate
' can range from 0 (2.5 repetitions/sec) to
' to 31 (about 30 repetitions/sec)
' If MAKEPERMANENT is True, then these new values persists among
' subsequent Windows sessions
'USAGE
'SetKeyboardRepeatInfo(0,31,True)
'THAT WILL SET EVERYTHING ON FAST
Last edited by Maltonomy; May 26th, 2005 at 09:56 AM.
-
May 26th, 2005, 10:06 AM
#2
Re: Setting the Keyboard Delay.
 Originally Posted by Maltonomy
*EDIT: got it (can't figure out how to delete this thread, maybe because its the first 1)
Yes, that is actually the reason you can't delete it.
However, I see no reason to delete it. Someone may come along with a question about this, and when they do a search, your post will show up and hopefully answer their question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|