Windows 7 / 10 and system tray

Started by etippelt, January 12, 2016, 12:59:52 PM

Previous topic - Next topic

etippelt

I have played around with the code examples for intcontrol 1007 but there is something missing. Currently testing on Win 10 64 bit and using the 64 bit RUN mode in the studio, as I am aware that the system tray on a 64 bit O/S needs 64 bit code to access.
On my machine, the icon for the "notification" function is permanently displayed in the system tray, as is the Dropbox icon, but the rest of the system tray icons are hidden and need the "up arrow" clicked on to show them. When I run the test code, sometimes the system tray icon I am adding appears in the visible system tray but most of the time the icon I am adding gets hidden.  My test cycles between two different icons to give a "flashing" effect but I would like this to be permanently visible in the system tray when created.  Is there an attribute or method of specifying an icon, that is added to the system tray, to be "never" hidden?  I want to create a visible flashing icon to alert users to any system updates going on in the background, to avoid any power downs, etc, at the wrong moment.
Using Winbatch since 1995. Excellent tool, awesome support always.

td

Quote from: etippelt on January 12, 2016, 12:59:52 PM
I have played around with the code examples for intcontrol 1007 but there is something missing. Currently testing on Win 10 64 bit and using the 64 bit RUN mode in the studio, as I am aware that the system tray on a 64 bit O/S needs 64 bit code to access.

You do not need to be a 64-bit application to reside there.  PopMenu is a 32-bit application and it reside quite happily in the notification area.

Quote
On my machine, the icon for the "notification" function is permanently displayed in the system tray, as is the Dropbox icon, but the rest of the system tray icons are hidden and need the "up arrow" clicked on to show them. When I run the test code, sometimes the system tray icon I am adding appears in the visible system tray but most of the time the icon I am adding gets hidden.  My test cycles between two different icons to give a "flashing" effect but I would like this to be permanently visible in the system tray when created.  Is there an attribute or method of specifying an icon, that is added to the system tray, to be "never" hidden?  I want to create a visible flashing icon to alert users to any system updates going on in the background, to avoid any power downs, etc, at the wrong moment.

The easiest way is just change the system settings:

http://windows.microsoft.com/en-us/windows-vista/show-all-icons-in-the-notification-area-system-tray
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

td

The above link applies to Vista/Windows 7.  On Windows 10 you click a the 'Notification area' button instead of a tab.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

etippelt

Thanks TD, but I'd rather not "show all" on the system tray buttons - there might be quite a few in a dev's system tray and it would cause a lot of confusion if all suddenly got displayed. There has to be a way of specifying whether a button is permanently displayed in the system tray, as for example my current machine has dropbox and the wireless connection permanently displayed as well as the notification button, plus the date time display and a weather icon at one end, and a custom toolbar link on the other end. There are also 14 hidden icons.
Using Winbatch since 1995. Excellent tool, awesome support always.

etippelt

I've had a further look at this, and it would appear that changing the setting of a system tray icon using the "Notification Area Icons" applet in Control Panel, is reflected in the registry keys under:
[HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify

The "default" when I create a system tray icon using IntControl 1007 is to set the icon as "Show only notifications".  What I want to achieve is to set the icon property to "Show icon and notifications".

Having googled around, this appears to be possible using some C code as per this link, which I will be investigating later: https://hianz.wordpress.com/2013/09/03/new-windows-tray-notification-manager-is-here/

It would be a **nice** feature to add to IntControl 1007.

Cheers
EdT
Using Winbatch since 1995. Excellent tool, awesome support always.

td

Of course the notification setting are in  the registry.   Where else would they be?   

You might want to consider reading  the usage guidelines before proceeding:

https://msdn.microsoft.com/en-us/library/windows/desktop/dn742495.aspx

You can make changes to our WinBatch script icon in the notification area using  the Shell_NotifyIcon  shell API.  There are several examples in the Tech Database that can be found by searching on 'Shell_NotifyIcon'.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

etippelt

Thanks - I will check that out in the morning.
EdT
Using Winbatch since 1995. Excellent tool, awesome support always.

td

I am not sure that you can use Shell_NotifyIcon to make the changes you wish to make because I have never tried it to make your change.  But is certainly worth an attempt.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

etippelt

I tried the examples in the tech database and they both work as long as I run as 32 bit rather than 64 bit. The balloon tooltip example is pretty much spot on for my needs, so I will play around with that a bit more to see how well I can adapt it for our environment.
Thanks for the pointers and general help
EdT
Using Winbatch since 1995. Excellent tool, awesome support always.

td

The example  can  be made to work with either a 32-bit or 64-bit script.  It is simply a matter of adjusting the binary buffer for the differences in structure alignment between the two architectures.  The easiest way to do that is to use DllStruct* functions instead of binary buffer functions because the DllStruct* functions are architecture aware.  They handle the differences for you automagically.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade