program RepositionWindowFromExeName;
{$APPTYPE CONSOLE}
uses
Dialogs,
// debug
JclSysInfo,
SysUtils, Windows;
var
APID: Cardinal;
AHandle: THandle;
rc: TRect;
begin
try
APID := GetPidFromProcessName('
QGet.exe');
// 11424
if APID <> INVALID_HANDLE_VALUE
then
begin
AHandle := GetMainAppWndFromPid(APID);
MessageDlg(GetWindowCaption(AHandle), mtInformation, [mbOK], 0);
// leer!
GetWindowRect(AHandle, rc);
MessageDlg(IntToStr(rc.Left) + #13#10 +
IntToStr(rc.Top) + #13#10 +
IntToStr(rc.Right) + #13#10 +
IntToStr(rc.Bottom) + #13#10
, mtInformation, [mbOK], 0);
end;
except
on E:
Exception do
Writeln(E.Classname, '
: ', E.
Message);
end;
end.