2
votes

My application works in this mode: on start read a INI with user settings then it will be show as normal window or minimized to tray icon. If the user had choose to start application minimized to tray icon, on start the user will not see the main window and the task bar icon but only the tray icon, the user can open the application by tray icon menu or by double click on tray icon. Besides on start the tray icon change image for some seconds until database data are load.

To to this I use a old component TCoolTrayIcon but now I'd like replace it with official TTrayIcon (Delphi 10 Seattle) but I have some problem:

  1. How can I start application minimized? (show only tray icon, no main window and no task bar icon);
  2. Show task bar icon only when main window is visible;

With TCoolTrayIcon this is simple but I cannot understand if possible with TTrayIcon, the task icon is always visible and I cannot start minimized in any way.

1

1 Answers

7
votes

How can I start application minimized?

In the .dpr file set Application.ShowMainForm to False before calling Application.Run.

Show task bar icon only when main window is visible.

The taskbar button is shown only when the main form is visible. So, use Show and Hide on the main form to control that. Equivalently set the Visible property.