As mentioned in the previous post I worked for the past days on a new way for changing the notification area. Luckily I found the blog from Geoff Chappell which led me to an interface which is implemented by EXPLORER to support the notification area of the taskbar. (http://www.geoffchappell.com/studies/windows/shell/explorer/interfaces/itraynotify/index.htm?tx=28) On his blog he describes how to use the interface and register the COM class TrayNotify.
To my surprise that didn’t work with windows 8. So i figured out that Microsoft must have changed the ITrayNotify interface for the new Explorer Version (Win7: 6.2; Win8: 6.3). After reverse engineering explorer.exe using OllyDbg I found out that the virtual function table after the IUnknown methods have slightly changed:
HRESULT RegisterCallback (INotificationCB *,unsigned long *)
HRESULT UnregisterCallback (unsigned long *)
HRESULT SetPreference (NOTIFYITEM const *)
HRESULT EnableAutoTray (BOOL)
//Look at virtual function table for correct signature
HRESULT DoAction (Dummy)
Cause of these changes i use two different dlls. One for WinXp,Win7 and one for Win8, Win10.
In my application i use managed WPF(.Net Framework 4.0) for the GUI and a dll with unmanaged c++ Code for defining the interface and registering the callback. I also implemented my own Callback to call a managed method(C# application) in an unmanaged function(my c++ dll). See: http://limbioliong.wordpress.com/2011/06/19/delegates-as-callbacks-part-2/.
You could do it without an unmanaged dll using Pinvoke with C# but i did it for educational purposes and cause i wanted to know if it would be possible.
I will attach the application with 2 different dlls. If you want to use the Program in windows 8 you have to rename TrayNotificationManagementWin8.dll to TrayNotificationManagement.dll and put the dll into the same folder as TrayManager.exe. Otherwise it will fail. The Datagrid list will automatically update itself if there is a notification change ongoing in the Notification area of Windows, like update, deleting or modifying something there.
If you want to use the programm silent via command line please use the following syntax:
TrayManager.exe -t “Programm ToolTip” 2
TrayManager.exe -p “Programm name” 2
So for example:
TrayManager.exe -t “Microsoft Outlook” 2
Here are the possible numbers:
0=hide when inactive
This will set the Outlook tray to Always Visible.
-t = To use the programs tool-tip to identify the specific icon in the Notification area.
-p = To use the programs executable to identify the icon. (e.g. for Outlook it would be Outlook.exe)
It only has to contain a word but it has to be in within “”;
I will attach the whole project source in the upcoming days after i did some commenting.
PS: Heres a Screenshot of the NotificationManager: