Skip to content

How to find non-obvious program names for icons in tray #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ajkessel opened this issue Jul 26, 2024 · 7 comments
Closed

How to find non-obvious program names for icons in tray #7

ajkessel opened this issue Jul 26, 2024 · 7 comments

Comments

@ajkessel
Copy link

Set-NotifyIcon is very handy! For most icons, I'm able to find the correct name string either because it's just the executable file for the underlying application or with a little trial-and-error guesswork.

But I have some icons in the systray that I cannot identify properly for Set-NotifyIcon to match them. Is there any way to determine the proper string for every tray icon?

One example is I have my own PowerShell script that puts an icon in the tray. But Set-NotifyIcon can't seem to find it. I've tried matching on pwsh.exe (which is the executable actually running the script), PowerShell, Powershell, the script name with correct capitalization, the name of the icon file used to generate the systray icon, as well as the tooltip text for the tray icon.

Is there a systematic way to figure this out? Or is there something inherent in a PowerShell script that creates a tray icon such that Set-NotifyIcon won't be able to find it?

@stevencohn
Copy link
Owner

Windows keeps track of all tray icons it's ever seen here: HKCU:\Control Panel\NotifyIconSettings which is what shows up in the Settings.

You can query it like this:

Get-ChildItem -Path 'HKCU:\Control Panel\NotifyIconSettings' -Name | % { `
   (Get-ItemProperty -Path "HKCU:\Control Panel\NotifyIconSettings\$($_)" `
   -Name ExecutablePath).ExecutablePath } | select-object -unique | sort

@ajkessel
Copy link
Author

Windows keeps track of all tray icons it's ever seen here: HKCU:\Control Panel\NotifyIconSettings which is what shows up in the Settings.

Is that Windows 11? I'm not seeing any similar registry in Windows 10.

@stevencohn
Copy link
Owner

Oh sorry, yes, Win11. I'm not sure about 10 but you should be able to find it with a quick google/bing/duck/of-your-choice

@ajkessel
Copy link
Author

ajkessel commented Jul 26, 2024

I've googled a fair bit and I can't find any non-obfuscated/non-encoded registry key for systray icons in Windows 10.

@stevencohn
Copy link
Owner

I wish I could help.

@ajkessel
Copy link
Author

ajkessel commented Jul 27, 2024

Is the logic/encoding you have in Set-NotifyIcon reversible? So instead of encoding the input string and comparing it with the registry values, could you decode the registry values and print them out for the user? Or is it a one-way encoding scheme?

@ajkessel
Copy link
Author

A found a solution with an AutoHotkey library called TrayIcon. This will create a message box with all the systray process names:

test := TrayIcon_GetInfo()
Loop, % test.MaxIndex()
    str .= test[A_Index].place " - " test[A_Index].idx " - " test[A_Index].process " - " test[A_Index].hwnd " - " test[A_Index].idcmd "`n"
MsgBox, %str%

You can close the issue if you like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants