代碼: 選擇全部
procedure Tform1.Button1Click(Sender: TObject);
var
hw: HWND;
begin
hw := findwindow(0,'Untitled - Notepad');
if hw <> 0 then
SetWindowPos(hw, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE);
// 或是使用 SetForegroundWindow(hw); 亦可
end;