Use GetLastActivePopup instead of Screen.ActiveForm.
- Screen.ActiveForm doesn't support non-VCL windows like the IDE's Find dialog.
- Screen.ActiveForm can be nil if the main form has been shown but never became the active window.
- Screen.ActiveForm can be nil if the active form was destroyed and another form hasn't been activated yet.
Show has a BringToFront call that we don't need. Changing Visible from False to True already brings the window to the front when not minimized. And when it is minimized, we don't want it becoming the active window.
This works around the same VCL issue as in preceding commits, where the Forms unit's WM_ACTIVATEAPP handler sets FAppIconic=False even though the window may still be minimized, which causes the next Application.Restore call to be a no-op.
Works around VCL bug. If Application.BringToFront is called while the app is minimized, the Forms unit's WM_ACTIVATEAPP handler inexplicably sets FAppIconic=False, which causes the next Application.Restore call to be a no-op.
Mostly done, I think. Still need to actually remove shWindowVisible etc. Still some Application.Handle references that need to be cleaned out. Still need to update help.
TMainForm still exists, but is no longer a form. Good enough for now.
With Application.MainFormOnTaskBar=True, we now have a working taskbar thumbnail and proper minimize/restore animations. Finally.
Displaying dialogs while the app is minimized is a bad idea (see AppMessageBox).
Planning to do the same with message boxes and task dialogs (the workaround in AppMessageBox is icky).
Also, to ensure dialogs have the correct owner when the app is inactive, include the same OnGetActiveFormHandle handler as the IDE.