Restoring window size correctly when maximized

Window size should be determined by GetWindowPlacement() method not by reading actual window size. When the window is maximized, the component saves its maximized size not restored size. When restarting application its state (maximized / restored) is restored correctly. But when clicking on restore button in top right border of window, its size is restored to the maximized size. Practically it means that window borders are leaking outside the screen. This is sample of source code that need to be changed:

with Settings, Placement, rcNormalPosition do
begin
if FSavePosition then
begin
WriteInteger(Key, 'Left', (Owner as TForm).Left); // !!!
WriteInteger(Key, 'Top', (Owner as TForm).Top); // !!!
end;
if FSaveSize then
begin
WriteInteger(Key, 'Right', (Owner as TForm).Left + (Owner as TForm).Width); // !!!
WriteInteger(Key, 'Bottom', (Owner as TForm).Top + (Owner as TForm).Height); // !!!
WriteBool(Key, 'Maximized', showCmd = SW_SHOWMAXIMIZED);
end;