Get window handle, maximize minimize Forms

// handle program found by the program header
function TfmPrintSet2.FindWindowByTitle (the WindowTitle: String): Hwnd;
var
NextHandle: Hwnd;
NextTitle: Array [0..260] of char;
the begin
// get the first
NextHandle: = GetWindow ( Application.Handle, GW_HWNDFIRST);
the while NextHandle> 0 do
the begin
// Get the title
the GetWindowText (NextHandle, NextTitle, 255);
IF Pos (the WindowTitle, StrPas (NextTitle)) <> 0 the then
the begin
the Result: = NextHandle;
the Exit;
End
the else
// get the next
NextHandle: = the GetWindow (NextHandle, GW_HWNDNEXT);
End;
the Result: = 0;
End;

// maximized form
Procedure TfmPrintSet2.MaxExWindow (TITLENAME: String);
var
Indicador: Hwnd;
the begin
// acquired by the program window title name
Indicador: = FindWindowByTitle (TITLENAME);
// finded IF
IF (Indicador <> 0) the then
the begin
// the Minimize
the ShowWindow (Indicador, the SW_MINIMIZE);
the ShowWindow (Indicador, SW_MAXIMIZE); // the SW_MINIMIZE
End;
End;

Guess you like

Origin www.cnblogs.com/zyb2016/p/11243694.html