Minimizing an FMX form with the menu bar button and then restoring by clicking on the task bar icon will bring the form back to the foreground, but will not activate the window. The form is also minimized "directly" rather applying the animation that "shrinks" the window to the taskbar. The forms OnActivate event is not fired.
Curiously, if I patch the WindowProc and call ShowWindow with SW_RESTORE upon deactivation the form will get restored properly after clicking the taskbar icon. I'm not sure why. The minimize animation still does not get fired though.
procedure TForm1.WindowProc(var Msg: TMessage);
begin
case Msg.Msg of
WM_ACTIVATE: if (Msg.WParamLo = WA_INACTIVE) then ShowWindow(WindowHandleToPlatform(Handle).Wnd, SW_RESTORE);
end;
Msg.Result := CallWindowProc(OrgWndProc, WindowHandleToPlatform(Handle).Wnd, Msg.Msg, Msg.WParam, Msg.LParam);
end;
I can observe this behavior with a blank FMX HD form on Windows 8. This seems like an obvious bug to me, is there a better way to work around it ?
I think I got around this by modifying the FMX.Platform.Win.pas file. In the TPlatformWin.CreateAppHandle method you need to comment (or remove) those lines:
FApplicationHWND := CreateWindowEx(WS_EX_WINDOWEDGE or WS_EX_APPWINDOW, FMAppClass.lpszClassName,
PChar(LApplicationTitle), WS_POPUP or WS_GROUP, 0, 0, 0, 0, GetDesktopWindow, 0, HInstance, nil);
Winapi.Windows.ShowWindow(FApplicationHWND, SW_SHOWNORMAL);
I think that solution came from the Embarcadero Discussion Forums. The message is gone, but I give you the link anyway in case it comes back: https://forums.codegear.com/thread.jspa?messageID=556541򇷽