Handling Right Click/Left Click of Task-bar Button in c#

空扰寡人 提交于 2019-12-12 02:32:17

问题


I have a form (having Taskbar button shown in Taskbar) and I want to handle left/right clicks of this Task-bar button. I searched everywhere but could find the right answer. There are some related queries posted in stack-overflow as well:

  1. Using wndproc in C# to minimize form on leftclick of taskbar

  2. How to Detect Right Click on the Taskbar

But, nobody seems to have given a proper answer to "How to do" it?

Is there any pointers or code snippet how to do it?

Please note that I am talking about Task-bar app button (please don't confuse with Systray menu or Notification area). I have explicitly stated it because I have seen this confusion several places.


回答1:


Your application doesn't get a say in how the task bar button is handled. The task bar is owned by windows, and is used by windows to control display and positioning of your application's windows. Basically your request is out-of-bounds in the windows playground.

Sorry.




回答2:


what you can do is to use TaskbarManager out of the ApicodePack library Windows 7 Taskbar C# Quick Reference where you are able to handle such events.



来源:https://stackoverflow.com/questions/7597281/handling-right-click-left-click-of-task-bar-button-in-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!