function FindWindowByTitle(WindowTitle:
string): Hwnd;
var
NextHandle: Hwnd;
NextTitle:
array[0..260]
of char;
begin
// Get the first window
NextHandle := GetWindow(Application.Handle, GW_HWNDFIRST);
while NextHandle > 0
do
begin
// retrieve its text
GetWindowText(NextHandle, NextTitle, 255);
if Pos(WindowTitle, StrPas(NextTitle)) <> 0
then
begin
Result := NextHandle;
Exit;
end
else
// Get the next window
NextHandle := GetWindow(NextHandle, GW_HWNDNEXT);
end;
Result := 0;
end;
procedure TSTRG.FormCreate(Sender: TObject);
var Handle:HWND;
begin
STRG.Hide;
Handle := FindWindowByTitle('
Nitro');
if handle <> 0
then
begin
SendMessage(
handle,WM_SYSCOMMAND, SC_MAXIMIZE, 0);
SetForegroundWindow(
handle);
end
else showmessage('
Fehler im Finden des Handles');
sleep(200);
keybd_event(VK_CONTROL, MapVirtualKey(VK_CONTROL, 0), 0, 0);
keybd_event(Ord('
Z'), MapVirtualKey(Ord('
Z'), 0), 0, 0);
keybd_event(Ord('
Z'), MapVirtualKey(Ord('
Z'), 0), KEYEVENTF_KEYUP, 0);
keybd_event(VK_CONTROL, MapVirtualKey(VK_CONTROL, 0), KEYEVENTF_KEYUP, 0);
Application.Terminate;
end;