兄弟 我发现不激活 还不行来 不过我以前弄过"向最小化的窗口中的Edit发送Ctrl + V 组合键" 实现过.
先这样了 不知道那为高手在来给看看
procedure TForm1.Button1Click(Sender: TObject);
var
WinHandle,EditHandle:HWND;
begin
// SetWindowPos(Handle,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE or SWP_NOSIZE);
WinHandle:= FindWindow(nil,Pchar('1.txt - 记事本'));
if WinHandle = 0 then ShowMessage('000');
AttachThreadInput(GetCurrentThreadID,GetWindowThreadProcessID(WinHandle,nil),True);
EditHandle:= GetWindow(WinHandle,GW_CHILD);
Windows.SetFocus(EditHandle);
Keybd_Event(VK_CONTROL,0,0,0);
Keybd_Event(ord('V'),0,0,0);
Keybd_Event(ord('V'),0,keyeventf_keyup,0);
Keybd_Event(VK_CONTROL,0,keyeventf_keyup,0);
// SendMessage(WinHandle,WM_SYSCOMMAND,SC_ICON,0);
AttachThreadInput(GetCurrentThreadID,GetWindowThreadProcessID(WinHandle,nil),False);
SetForegroundWindow(Handle);
// SetWindowPos(Handle,0,0,0,0,0,SWP_NOMOVE or SWP_NOSIZE OR SWP_NOZORDER);
end;