Jo example s NOTEPAD funguje, ale problem je libovolna aplikace.
a abychom nemluvili na vode:
program AppPosXY;
// napr.: notepad "a.txt - Poznámkový blok" 200 100
// {$APPTYPE CONSOLE}
uses
SysUtils, Windows;
var
Wnd : HWND;
s1, s2 : string;
X, Y : integer;
begin
try
s1 := ParamStr(1);
s2 := ParamStr(2);
X := StrToInt(ParamStr(3));
Y := StrToInt(ParamStr(4));
except
Exit;
end;
if s2 = 'nil' then
Wnd := FindWindow(PChar(s1), nil)
else
Wnd := FindWindow(PChar(s1), PChar(s2));
SetWindowPos(Wnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE or SWP_NOMOVE or SWP_SHOWWINDOW);
SetWindowPos(Wnd, 0, X, Y, 0, 0, SWP_NOSIZE or SWP_NOACTIVATE or SWP_NOZORDER);
end.