delphi 键盘按键模拟
Keyboard events, along with mouse events, are the primary elements of a user's interaction with your program.
键盘事件和鼠标事件是用户与程序交互的主要元素。
Below is information on three events that let you capture a user's keystrokes in a Delphi application: OnKeyDown, OnKeyUp and OnKeyPress.
以下是有关三个事件的信息,这些事件使您可以在Delphi应用程序中捕获用户的击键: OnKeyDown , OnKeyUp和OnKeyPress 。
向下,向上,按,向下,向上,按... ( Down, Up, Press, Down, Up, Press... )
Delphi applications can use two methods for receiving the input from the keyboard. If a user has to type something in an application, the easiest way to receive that input is to use one of the controls that automatically responds to keypresses, such as Edit.
Delphi应用程序可以使用两种方法从键盘接收输入。 如果用户必须在应用程序中键入内容,则接收该输入的最简单方法是使用自动响应按键的控件之一,例如“编辑”。
At other times and for more general purposes, however, we can create procedures in a form that handle three events recognized by forms and by any component that accepts keyboard input. We can write event handlers for these events to respond to any key or key combination the user might press at runtime.
但是,在其他时候和出于更一般的目的,我们可以以某种形式创建过程,以处理由表单以及接受键盘输入的任何组件识别的三个事件。 我们可以为这些事件编写事件处理程序,以响应用户在运行时可能按下的任何键或组合键。
Here are those events:
这些事件如下:
OnKeyDown - called when any key on the keyboard is pressedOnKeyUp - called when any key on the keyboard is releasedOnKeyPress - called when a key corresponding to an ASCII character is pressed
OnKeyDown-在按下键盘上的任何键时调用OnKeyUp-在释放键盘上的任何键时调用OnKeyPress-在按下与ASCII字符对应的键时调用
键盘处理器 ( Keyboard Handlers )
All the keyboard events have one