http://bugs.winehq.org/show_bug.cgi?id=15069
--- Comment #26 from Felix Saphir felix.saphir@presswatch.de 2009-07-13 16:28:26 --- (In reply to comment #10)
[http://www.delphicorner.f9.co.uk/articles/apps7.htm]
All messages go to this window and it monitors the messages and passes what is needed to the main form's window.
After investigating this a little, it seems that the hidden application window does *not* pass WM_SYSCOMMAND with parameter SC_MINIMIZE (or SC_RESTORE) to ShowWindow, as one might expect.
Instead, both messages are passed on to a) either DefWindowProc (which is DefWindowProcA from user32.dll) or b) an internal wrapper around ShowWindow, that disables animation via SystemParametersInfo(SPI_SETANIMATION, ...) for that call to ShowWindow. I never saw the latter happen during my debugging.
I'm under the impression, that restoring the window is the problem, while minimizing seems to work fine. Using the Application.HookMainWindow() as suggested in the Delphi Corner article (thanks for that!), it's possible to handle the SC_RESTORE message in a procedure like this:
| if ((msg.WParam and $FFF0) = SC_RESTORE) then | begin | // restore "hidden" form: | ShowWindow( Application.Handle, SW_NORMAL ); | // restore MainForm: | ShowWindow( Application.MainForm.Handle, SW_NORMAL ); | // hide "hidden" form again | ShowWindow( Application.Handle, SW_HIDE ); | Result := True; // message is handled | end else | Result := False; // message not handled
... and it seems to do the trick (except for desktop switching).
Does that help investigating this issue?