procedure Tform1.keyevent(str:string);<br>var<br> i : integer;<br> c : byte;<br>begin<br> keybd_event(vk_Return,0,0,0);<br> keybd_event(vk_Return,0,KEYEVENTF_KEYUP,0);<br> for i := 1 to Length(str) do<br> begin<br> c := VkKeyScan(str) and 255; //输入文字<br> keybd_event(c,0,0,0);<br> keybd_event(c,0,KEYEVENTF_KEYUP,0);<br> end;<br> keybd_event(vk_Return,0,0,0); //输入后回车<br> keybd_event(vk_Return,0,KEYEVENTF_KEYUP,0);<br>end;<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>begin<br>keyevent('q8888');<br>end;<br>