delphi 切换指定窗口到最前并获得焦点
//静态加载SwitchToThisWindow
procedure SwitchToThisWindow(hWnd:Thandle;fAltTab:boolean);stdcall;external 'User32.dll';
procedure SwitchToThisWindow(hWnd:Thandle;fAltTab:boolean);stdcall;external 'User32.dll';
procedure TForm1.Button1Click(Sender: TObject);
var
h:thandle;
begin
h:=findwindow(nil,'test'); //为外部EXE标题
SwitchToThisWindow(h,true);
end;