C# How to determine if hwnd is in tray icons

后端 未结 3 1799
难免孤独
难免孤独 2021-01-21 18:37

I am trying to get the hwnd of the current tray icons. what I did is getting the hWnd of system trat window by using this code:

[DllImport(\"user32.dll\", SetLas         


        
3条回答
  •  后悔当初
    2021-01-21 19:07

    The 'children' of the ToolbarWindow32 are not windows. They are toolbar buttons. You'd use the TB_BUTTONCOUNT message to retrieve the number of buttons, TB_GETBUTTONINFO message to retrieve info about such a button. Quite hard to do btw since the window belongs to another process, just using SendMessage() doesn't work because the pointer isn't valid. And ultimately futile, such a button doesn't contain any information about what kind of process is associated with the icon. That's info that's buried inside the shell, you can't get to it.

提交回复
热议问题