I am using Delphi 5.
I've add a trayicon in application and need to make the trayicon bright or change colour in different status. Anyone can help?
Thanks and Thanks.:$
How did you add it? (Did you use some component you got off the web or did you use the Shell_NotifyIcon function?)
Changing the icon is simply a matter of using NIM_MODIFY with a different icon handle in the hIcon field of the same NOTIFYICONDATA record you first used to put the icon there to begin with.
If it was some component check the documentation...
Hope this helps.
Thanks for reply!
It is write the code as following?
TrayNotifyIcon1.Icon.Handle()
No...
How exactly did you get an icon into the system tray to begin with?
1. I have add a trayicon component into form , TrayNotifyIcon1: TTrayNotifyIcon
2. there is a property 'Icon', click into the 'Icon' property, I able to load icon image for it.
:?:
OK, I found the component on the web.
All you need is the TIcon you wish to display. You can load it by sticking a TImage component on your form, setting its visible property to false, and accessing the TImage's picture.icon property.
Then just set the icon property of the tTrayNotifyIcon component:
TrayNotifyIcon1.icon := Image1.picture.icon;
The icon on the taskbar should update automatically. Keep in mind that if you may have to save the old icon if you want to restore it later.
Hope this helps.
BTW, were you able to get that last bit of code I gave you to work (to display the main form's button instead of the application's button on the taskbar)?
OK, I found the component on the web.
All you need is the TIcon you wish to display. You can load it by sticking a TImage component on your form, setting its visible property to false, and accessing the TImage's picture.icon property.
Then just set the icon property of the tTrayNotifyIcon component:
TrayNotifyIcon1.icon := Image1.picture.icon;
The icon on the taskbar should update automatically. Keep in mind that if you may have to save the old icon if you want to restore it later.
Hope this helps.
Dear Friend,
Thanks so much! Your solution really help me a lot!!:icon_lol:
BTW, were you able to get that last bit of code I gave you to work (to display the main form's button instead of the application's button on the taskbar)?
This one not yet :(
What the request is totally hide the application (only trayicon but application or mian form whichsoever must nothing in task bar after call the hide function). However I tried and tried , after hide, application ( or main form?) still show in taskbar. :(
Make sure use use the code I gave you here and it will:
hide the application button from the taskbar (ApplicationActivate proc),
prevent it from reappearing (SysCommandMessage message proc), and
display a button for your main form (CreateParams proc) [but only when the main form is visible].
Good luck.
OH YEAAH!! IT WORK ! IT WORK!!
THANK you~~ ^O^
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.