D5光盘上有个sndkey32单元,查找到将其copy到delphi5/lib目录,<br>里面有个函数SendKeys。ok,打开你的记事本。<br>uses<br> sndkey32<br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br> handle:Thandle;<br>begin<br> handle:=findWindow('NotePad',nil);<br> handle:=FindWindowEX(handle,0,'Edit',nil);<br> SetForegroundWindow(handle);<br> sendkeys('v',true); //成功<br> //postmessage(handle,WM_KeyDown,byte('v'),0);<br> //postmessage(handle,WM_Keyup,byte('v'),0);//没有成功<br>end;<br>xiaomin说得对,改为这样就行了<br> postmessage(handle,WM_KeyDown,VkKeyScan('v'),0);