Finally: Remove annoying TabletPC icon from systray
Quick download: Media:Deltabletray.zip
For a brief description, click on "read more"
I do not want to use the feature of WindowsXP to hide system tray icons. On the other side, there is the tray icon “Tablet PC” which can’t be removed. I searched the whole net but anybody gave the “tip” to hide it with XPs feature. I really don’t need this icon because all of the features are accessible by hardware buttons.
Accessing system tray
Accessing system tray isn’t really a simple job. There is only one API function: Shell_IconNotify. This function sets an icon to system tray or removes it but only if a few parameters are known: The window handle of the window receiving the messages and an application defined ID. Every user can call this function to remove/modify an icon but the problem is: where to get the hwnd and the uID?
Enumerating systray icons
I searched a lot in the net about that question and almost the one thing I could find is that’s not possible. At least not without reading out systray memory and do RE. But then I found a VB program that could read out the tooltips: http://www.freevbcode.com/ShowCode.Asp?ID=3291. I translated that code to C and tried it: After two hours work, it worked but only the tooltips are read out. Then I searched google a second time with better expressions: “ReadProcessMemory” and “NOTIFYICONDATA”. This combination should be only useful for reading out the NOTIFYICONDATA structures from system tray from another application. Along silly pages from experts-exchange (the want to be paid for viewing forum posts - really ugly!) I finally found a solution on codeproject. This app only works with WindowsXP and does not rawly read out memory. Instead, it uses toolbar functions. I simply extened this program to read out/display all the other functions needed.
I finally found out the HWND of the window and that the uID was zero. The name of the window I obtained with spy by searching for the window handle. It belongs to a window with window class “TabBtnU_MonitorWndClass”. This window belongs to a process called tabbtnu.exe, which also recreates the icon after the process is killed. So it was very easy to implement a small program that gets the HWND with FindWindow, fill in a NOTIFYICONDATA and call Shell_NotifyIcon. That’s all what the little exe file does.
It's compiled with lcc32.