试试下面代码。<br><br>procedure TForm1.FormClick(Sender: TObject);<br>var t1,t2:Integer;<br> wnd:HWND;<br>begin<br> WinExec('NotePad.exe',SW_NORMAL);<br> t1:=GetTickCount;<br> t2:=t1;<br> while t2-t1<2000 do begin<br> t2:=GetTickCount;<br> wnd:=GetForegroundWindow;<br> if wnd<>Handle then begin<br> Windows.SetParent(wnd,Handle);<br> Break;<br> end;<br> end;<br>end;<br><br>被运行的程序可以得到键盘输入焦点呀。