procedure TForm1.Button1Click(Sender: TObject);<br>var<br> tmp:string;<br> i:Integer;<br> GetKey : Integer;<br>begin<br> Edit1.SetFocus;<br> Edit1.SelectAll;<br> Sleep(2000);<br><br> tmp := 'China';<br> for i:=1 to length(tmp) do<br> begin<br> GetKey := ord(tmp);<br> if (GetKey &gt;= 65) and (GetKey &lt;= 90) then // A..Z 大写<br> begin<br> keybd_event(VK_LSHIFT,0,0,0);<br> keybd_event(GetKey,0,0,0);<br> keybd_event(GetKey,0,KEYEVENTF_KEYUP,0);<br> keybd_event(VK_LSHIFT,0,KEYEVENTF_KEYUP,0);<br> end<br> else if (GetKey &gt;= 97) and (GetKey &lt;= 122) then // a..z 小写<br> begin<br> GetKey := GetKey - 32;<br> keybd_event(GetKey,0,0,0);<br> keybd_event(GetKey,0,KEYEVENTF_KEYUP,0);<br> end<br> else // 其它的也<br> begin<br> keybd_event(GetKey,0,0,0);<br> keybd_event(GetKey,0,KEYEVENTF_KEYUP,0);<br> end;<br> end;<br>end;