Which Windows process is displaying a given taskbar system tray icon? - windows

How do I find which Windows process is displaying a given taskbar system tray icon?

I've just realised that in Windows 7 the 'Select which icons and notifications appear on the taskbar' menu helps a bit here. Find it by right-clicking the taskbar, go to 'Properties', then click the 'Customize...' button in the 'Notification area' frame.
Each row in that window represents a taskbar icon that Windows Explorer has seen. Of the left two rwos, I believe the top one is the process's description as shown in Task Manager, and the bottom one is the window title for the window showing the taskbar icon.
This would've helped me track down my original problem! VisualSVN was popping up a 'Register me!' nag window in the system tray, despite no obvious VisualSVN processes running. Eventually I noticed that this nag window disappeared when I closed Visual Studio, so it was clear that the VisualSVN add-in DLL loaded in Visual Studio was creating the nag window.

Shell_NotifyIcon works by sending a special WM_COPYDATA message to the taskbar, if you inject into explorer and subclass the taskbar you could catch this message, you could then get the process id by calling GetWindowThreadProcessId on COPYDATAstruct.NOTIFYICONDATA.hwnd.
...and of course, this is a hack and relies on undocumented information that could change at any time!

I don't believe this to be possible. Certainly Spy++ reports that the Notification area is a single window named "User Promoted Notification Area". This window is ultimately parented with the desktop window and has no obvious association with the process that created the notification icon.
Well, by possible I mean possible without resorting to hacks like Anders suggests which is no doubt feasible, but not what I imagine the OP is looking for!

Related

Windows taskbar icon event type - WxPython Phoenix

I am trying to find the event type associated with windows taskbar icon of my application. In Windows 8.1 user can close, minimize and restore the application from this icon.
Google is only showing the results for taskbar tray icons, which is a whole different thing. So far I've tried these:
wx.EVT_CLOSE # This event is not generated for taskbar closing
wx.EVT_RESTORE # This event is not generated either
Yet, it does close the application and it also manages to restore an iconized application. I made two separate handlers to check this. They are working when I use the titlebar buttons (close and min/maximize buttons), but not when done from the taskbar.

How to show the notify icon in taskbar for windows 7?

I implement a notify icon for my application by call Shell_NotifyIcon.
In the default, the notify icon display in the notify icon area instead of task bar in windows 7.
If the user want to show the notify icon in the task bar, he/she need to open the Notification Area Icons control panel item, find the application and set "Show icon and notifications" for the application.
I think it will be difficult to the user with poor windows knowledge. I want to implement this function that show the notify icon in the task bar in my VC++ code or installer. Is it possible? If yes, what should I do?
Appreciate.
No, this is not possible.
Windows 7 introduces a feature where notification icons can be hidden. It is an attempt to reduce the noise created by decades of developers dumping notification icons in the taskbar for no good reason.
In order for that feature to work effectively, there can't be a loophole for applications to get around it, because everyone thinks their application is the most important and the most deserving of prime real estate. Eventually, nothing is sacred anymore.
Raymond Chen has blogged about this very request, and provides some additional background info.
You just create the notification icon and provide the user with instructions in the documentation on how to show it permanently, if they so desire.
Why not just pin your application to the task bar? They can just click it and it will launch the application?

Win32 C++ - Do something when window is restored, which message?

So, I have a dialog based application using pure WinAPI. There is a main dialog, and then multiple other dialogs that are toolwindows. These toolwindows are meant to free-float around, the user can drag them, hide them, and show them, but they have no taskbar entry. This is what I intended, but the problem is, when I switch from the main window to a different application, then click on the taskbar entry for the main window, the main window will show up, but the toolwindows will not. They stay hidden behind the main window and sometimes windows of other applications, and you cannot use them until you move all of the top-most windows and hunt down the toolwindow.
So, what I'm trying to do to work around this is, when the user restores the window from being minimized, I want to enumerate through all of the tool windows and bring them to the front, maybe by calling SetActiveWindow().
But what message gets sent when the window is restored? I was thinking WM_SHOW, or WM_RESTORE, but they don't exist.
Another question, and if you answer this the first question is irrelevant because I will no longer need to use that workaround: Is there a better method of bringing all tool-windows to the front?
Give the tool windows the WS_POPUP style (and not WS_OVERLAPPED), and make the main window their parent (strictly it is their owner window). That way the tool windows will remain on top of the main window. This may (or may not) be what you want.
The naive answer to the question is to listen to WM_SIZE and respond to a wParam value of SIZE_RESTORED.
The other obvious possibility is to make all the tool windows be owned by the main window. So long as you are happy for the tool windows always to be on top of the main window, this will solve your problem. The owned windows will be hidden when the owner is minimized, and re-shown when the owner is restored.
Learn more about ownership in the MSDN topic on Window Features.

How can I disable / permanently hide the taskbar in Windows 7?

I would like to completely remove the Windows 7 taskbar, including tray and start-button, so that the user can not reactivate it by pressing the Windows-key on the keyboard. however, all other explorer functionality (i.e. starting an explorer Window using Windows+E) should remain.
Is it possible to permanently hide the complete taskbar? Maybe there are some registry values on could change in order to make that behaviour selectable using a powershell script?
Thanks a lot
Here be my solution (it hides rather than replaces or removes the native taskbar - this allows it to work with programs that have a dependency on the native taskbar, such as display fusions taskbar).
disable-taskbar-always-top
Still to solve: [HALF SOLVED]
Eliminate the stupid line that auto-hide leaves with some maximized applications, such as Google Chrome
HALF SOLUTION -
If you move the taskbar to the left or right edge prior to doing the above steps, you don't get the stupid auto-hide line at the top or bottom of Google Chrome. Since the native taskbar is not mouse sensitive anymore, it won't impact your use of hot corners, or multi monitors (for instance I have the native taskbar on the left of my middle monitor, and it does not popup when moving between monitors using the steps in this post).
Okay, I think I have finally - finally - got a workaround that:
Keeps the native Windows 7/8 taskbar hidden for your session (you do have a couple of steps you need to do on start-up each time, or if you manually un-hide the taskbar).
Prevents the native Windows 7/8 taskbar from opening with popups or programs seeking attention (flashing taskbar thing).
Prevents the native taskbar from being mouse sensitive (i.e. despite auto-hide, it will not appear when you mouse over the hidden taskbar anymore).
Allows you to use the screen area that is occupied by the native taskbar (this is the problem of not combining Taskbar-Hide with the autohide setting; you can't use that screen real-estate).
Allows you to run alternative taskbars that are dependent on keeping the native taskbar functional (for instance Dislay Fusions Multi-Monitor Taskbar + [Settings >> Advanced Settings ?> 'Show On All Montiors'])
One Time Steps:
1) Download and run this registry edit to prevent balloon notification popups from the native taskbar/system tray:
Notifications - Enable or Disable Message Balloons - Windows 7 Help Forums
(You can open this in notepad to see what changes it will make prior to installing it, if you want).
2) Download and run Taskbar-Hide from here:
Hide Taskbar: Hide Taskbar in Windows 8 | 7 with a hotkey
3) Set the taskbar to auto-hide
Optional:
3) B) Add a shortcut to Taskbar-Hide.exe in your startup folder, to have it launch automatically with windows on startup (you still need to use the Ctrl+Esc hotkeys to activate the functions of taskbar-hide - though you could also script this if you were really keen).
Startup Folder:
C:\Users{User Name}\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
Steps to hide taskbar after each start-up or manually un-hiding using Taskbar-Hide
4) Make sure Taskbar-Hide is running.
5) Make sure the taskbar is in its auto-hide state (i.e. you'll have to look at any programs that are currently seeking attention).
6) Once the taskbar is 'auto-hidden', press the hotkeys for Taskbar-Hide (Ctrl+Esc)
[This should mean that the native taskbar area is no longer sensitive to mouse activity]
One way is to replace the explorer shell with your own shell. This is the a common method done in Windows 7 Embedded.
In older versions of Windows (such as XP) it was possible to specifiy a shell for each user via regedit. I am not sure this is easily possible in Windows 7.
See https://superuser.com/questions/352865/how-do-i-change-the-windows-shell-for-only-one-user
Make an empty exe file and use it as the file to use in your "Custom User Interface" group policy. Additional information here.
I have found another solution that works nearly perfect for me, by just hiding the Taskbar and the Start button by simply sending both the WM_HIDE message:
Handle = FindWindow("Shell_TrayWnd", "");
...
ShowWindow(Handle, SW_SHOW);
The only problem I have with that solution is that the taskbar is not hidden permanently, i.e. as soon as one element is activated that does not have the focus, which on the taskbar leads to the item flashing in yellow, the taskbar gets visible again.
I'm not sure if there is a way to prevent Windows from re-enabling the visible flag of the taskbar in some way, or a method to hook to the SW_SHOW in C# though.

How do I prevent installer dialog from appearing partly off screen?

Has anybody seen this installer problem where the user runs an uninstall from the control panel, minimizes the window once the uninstall gets underway and then, when he restores the window after the point where the Finish Uninstalling screen would appear, the window shows up partly off screen? Does anybody know how to prevent this from happening? Or is this simply a bug in Windows Installer that we have to mention in our installer's user documentation?
I'm not sure how to reproduce this behavior to think about how to address it.
In my installers ( InstallShield and WiX mostly ) if I do a "Remove" I get a minimal ui experience that doesn't have a minimize button or a finished dialog. If I do a "Change" and select remove my progress dialog has a minimize but when that dialog is done and the installer switches to a Finished type dialog I get the dialog full size and centered on the screen again as it's a new dialog.

Resources