xaid
xaid

Reputation: 750

Components inside a Balloon hint

I'm trying to figure out a way to add a TButton inside a TTrayIcon Balloon Hint.

Is that possible?

Application description and goal:

Basically my software detects when a USB device is connected to the computer and automatically pops up a balloon hint which notifies the user that a new device has been connected.

What should happen next is to ask the user "Do you want to execute operation A or operation B?", and I'd like to give the user fast access to the options directly inside the ballooon hint.

What I have tried:

Googling a lot, but no success, because there is no info about how to access the balloon hint interface in any way.

I am using Delphi XE2 on Windows 8.

Upvotes: 0

Views: 844

Answers (1)

Remy Lebeau
Remy Lebeau

Reputation: 597916

TTrayIcon is a wrapper for Shell_NotifyIcon(), which does not support custom controls in its popup notifications.

You will have to create your own popup window. You can use Shell_NotifyIconGetRect() if you want to position it relative to the tray icon. Just be aware that system tray icons can be hidden by the user, so be prepared that you may have to position your popup window without knowing where the icon is located at times.

Upvotes: 4

Related Questions