两个窗口 form1、form2 <br>在 form1 放 Button1、Button2 加上下面的程序 <br>在 form2 放 memo1<br>无论 form2 是否 Show,Memo1 都会被 Ctrl + v<br><br>unit Unit1;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> Dialogs, StdCtrls;<br><br>type<br> TForm1 = class(TForm)<br> Memo1: TMemo;<br> Button1: TButton;<br> Button2: TButton;<br> procedure Button1Click(Sender: TObject);<br> procedure Button2Click(Sender: TObject);<br> private<br> { Private declarations }<br> public<br> { Public declarations }<br> end;<br><br>var<br> Form1: TForm1;<br><br>implementation<br><br>uses Unit2;<br><br>{$R *.dfm}<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>begin<br> form2.Show;<br>end;<br><br>procedure TForm1.Button2Click(Sender: TObject);<br>var<br> keyboardState: TKeyBoardState;<br> hWnd:HWnd;<br>begin<br> hWnd:= form2.memo1.Handle;<br> keyboardState[17] := 129;<br> SetKeyBoardState(keyboardState);<br> PostMessage(hWnd, 256, 86, 1);<br> Application.ProcessMessages;<br> keyboardState[17] := 0;<br> SetKeyBoardState(keyboardState);<br>end;<br><br>end.