Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Help: AutoRepeat Commands or Actions from Mouse or Keyboard events

If a user click a mouse button or press some key on a keyboard then if s/he hold it for a couple of seconds then the program will repeat the action. How does that work ?? For example a navigation button, a drawing program, or drag and drop task.

Do i have to use the Timer, and Mouse Events like Mouse_Down and Mouse_Up but that events use non optional arguments. Or i have to use some Win32 API ? I don't know the logic.

Please help me to give the answer. So many thanks for any kind of help.
[516 byte] By [me_code2004] at [2007-11-11 6:48:58]
# 1 Re: Help: AutoRepeat Commands or Actions from Mouse or Keyboard events
You don't have to do anything to cause keyboard events to repeat; Windows does that automatically. To create auto-repeating mouse events, do this:

Add a Timer to your form. Set its Interval property to the frequency with which you want Click events to occur (in milliseconds). Set its Enabled property to False. In the command button's MouseDown event, set the Timer's Enabled property to True. In the Timer's Timer event, call your button's Click event procedure.
Phil Weber at 2007-11-11 17:27:57 >