recently had a request to refactor several portions of an old app
had to solve this issue also for win7
so this is what worked for me maybe will be useful for someone else
uses
sysutils,
Forms, Interfaces,
windows,
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Classes ................
......................
......................
procedure proc_DoMaximizeConsole;
var loc_Out:HANDLE;
loc_Handle: THandle;
loc_MaxSize:COORD;
loc_NewDisplay:TSmallRect;
begin
loc_Handle:=FindWindow(nil, pchar(Application.ExeName));
loc_Out:=GetStdHandle(STD_OUTPUT_HANDLE);
loc_MaxSize:=GetLargestConsoleWindowSize(loc_Out);
SetConsoleScreenBufferSize(loc_Out, loc_MaxSize);
with loc_NewDisplay do begin
Right:=loc_MaxSize.X;
Bottom:=loc_MaxSize.Y;
end;
SetConsoleWindowInfo(loc_Out, True, loc_NewDisplay);
ShowWindow(loc_Handle, SW_MAXIMIZE);
ReadLn;
end;
begin
proc_DoMaximizeConsole;
.......................
.......................
end.