Delphi/Lazarus: Show Application with Icon in System Tray
Question by Guest | 2015-03-19 at 14:15
In Windows, there is this Taskbar Notification Area or TNA in the down right of the screen (sometimes also referred as System Tray, Systray or Tray) in which you can find the icons of some applications.
How can I implement this using Delphi or Lazarus? I would like to show the main window of my program when clicking the SysTray Icon and I would also like to have the possibility to let the window disappear to this location (for example when minimizing the window or with clicking a button).
Does someone have a tip for me how to do it?
Related Topics
MIME Types of Microsoft Office File Formats
Info | 0 Comments
Lazarus: Detect Operating System (Compiler Switch)
Tutorial | 0 Comments
Delphi/Lazarus: How to set up a Link to a Website in an Application
Tutorial | 0 Comments
Delphi: Global Treatment of Errors (Exceptions)
Tutorial | 0 Comments
Delphi: System-Wide HotKey
Tutorial | 1 Comment
VirtualBox: Change Date and Time
Tutorial | 10 Comments
Delphi/Lazarus: Command Line Parameter Tutorial Part 1: Sending
Tutorial | 0 Comments
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.
In the tab "Additional", you can find the component TTrayIcon. When dropping this to you application, you should have all you need.
You can exactly adjust the behavior in the properties of TrayIcon to your needs.
Assumed, you have a button on your form, you can realize the following, for example:
With this, your window is hidden and simultaneously shown as TrayIcon.
Of course, you can also do the same when the user is minimizing the window:
With this, the window is directly minimized to the tray.
To get back the window, you can write the following code into the OnDblClick event of the TrayIcon:
In other words, when double-clicking the TrayIcon, the window will be displayed again, the window gets the focus and the TraycIcon is set to invisible.
I think with those snippets, you have enough sources to implement what you need and of course, you can adjust all of those functions to your requirements.
2015-03-22 at 03:19