unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
Timer1: TTimer;
procedure Button1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
postmessage(edit1.Handle,WM_KEYDOWN,65,0); //通过向编辑框1对象发送按键码值为65
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
postmessage(form1.Handle,WM_KEYDOWN,VK_TAB,0); //通过向Form1对象发送按键码值为TAB
end;
end.