Search code examples
delphi-10.2-tokyomultiscreen

delphi7 converted to delphi tokyo app taskbar icon does not like to move to second screen app


my delphi7 apps always show in the primary screen monitor taskbar 😣, Now in delphi 10.2 If I move the app to the second screen the taskbar icon move to that seconds screen 🆒. So now my issue is with the old delphi7 apps which I open and compile with delphi 10.2, they still have the old behavior 😱. So how can I solve that?? 🤔


Solution

  • In Delphi 7, all TForm windows are owned by the hidden TApplication window at runtime, which is the window that actually manages the app's Taskbar button. That window remains on the primary monitor when you move your Forms to other monitors. That is why you don't see the app's Taskbar button move to other monitors.

    In Delphi 2007 and later, TForm windows are no longer owned by the hidden TApplication window by default on Vista+. This behavior is controlled by the TApplication.MainFormOnTaskBar property, which did not exist yet in Delphi 7. Being owned by the hidden TApplication window causes all kinds of problems in Vista+ for the Taskbar, the Task switcher, Aero, etc, so ShowMainFormOnTaskBar should always be set to true.

    When you upgrade your Delphi 7 project to Delphi 10.2, be sure to set Application.MainFormOnTaskBar := true; in the app's main startup code so the app interacts with Vista+ properly. MainFormOnTaskBar is false by default when migrating a pre-D2007 project.