Here is a way to handle it in FMX on Windows, you need to change your form to inherit from TResizeForm
and assign OnResizeEnd
property. Not very clean since it depends on on FMX internals, but should work.
unit UResizeForm;
interface
uses
Winapi.Windows,
System.SysUtils, System.Classes,
FMX.Types, FMX.Forms, FMX.Platform.Win;
type
TResizeForm = class(TForm)
strict private
class var FHook: HHook;
strict private
FOnResizeEnd: TNotifyEvent;
public
property OnResizeEnd: TNotifyEvent read FOnResizeEnd write FOnResizeEnd;
class constructor Create;
class destructor Destroy;
end;
implementation
uses Winapi.Messages;
var
WindowAtom: TAtom;
function Hook(code: Integer; wparam: WPARAM; lparam: LPARAM): LRESULT stdcall;
var
cwp: PCWPSTRUCT;
Form: TForm;
ResizeForm: TResizeForm;
begin
try
cwp := PCWPSTRUCT(lparam);
if cwp.message = WM_EXITSIZEMOVE then
begin
if WindowAtom <> 0 then
begin
Form := TForm(GetProp(cwp.hwnd, MakeIntAtom(WindowAtom)));
if Form is TResizeForm then
begin
ResizeForm := Form as TResizeForm;
if Assigned(ResizeForm.OnResizeEnd) then
begin
ResizeForm.OnResizeEnd(ResizeForm);
end;
end;
end;
end;
except
// eat exception
end;
Result := CallNextHookEx(0, code, wparam, lparam);
end;
class constructor TResizeForm.Create;
var
WindowAtomString: string;
begin
WindowAtomString := Format('FIREMONKEY%.8X', [GetCurrentProcessID]);
WindowAtom := GlobalFindAtom(PChar(WindowAtomString));
FHook := SetWindowsHookEx(WH_CALLWNDPROC, Hook, 0, GetCurrentThreadId);
end;
class destructor TResizeForm.Destroy;
begin
UnhookWindowsHookEx(FHook);
end;
end.