Handling Right Click/Left Click of Task-bar Button

2019-08-22 03:59发布

问题:

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.