2

I need to know the code for taskbar right click application context menu for windows vista and higher in C#. For older versions of windows this code is 0x313. In vista and higher this code means shift + right click. I can't find the code for right click only in application context menu in taskbar.

Sergey Shafiev
  • 4,205
  • 4
  • 26
  • 37
  • duplicate of [Handling Right Click/Left Click of Task-bar Button in c#](http://stackoverflow.com/questions/7597281/handling-right-click-left-click-of-task-bar-button-in-c-sharp) – Scott Solmer Feb 24 '14 at 14:40
  • I know that this question is quite a long time ago, but If anyone are searching for it like me now (at 2018), it's called Jump List, you can checkout sample of JumpList in **Windows API Code Pack** (https://stackoverflow.com/a/25048686/2133965) at **Samples/Shell/TaskbarDemo/CS** – VietDD Sep 16 '18 at 01:24

1 Answers1

-1

What you are looking for is Associating a Context Menu with a Windows Forms NotifyIcon Component

The Windows Forms NotifyIcon component displays an icon in the status notification area of the taskbar. Commonly, applications allow you to right-click this icon to send commands to the application it represents. By associating a ContextMenu component with the NotifyIcon component, you can add this functionality to your applications.

public NotifyIcon notifyIcon1 = new NotifyIcon();
public ContextMenu contextMenu1 = new ContextMenu();

public void createIconMenuStructure()
{
   // Add menu items to context menu.
   contextMenu1.MenuItems.Add("&Open Application");
   contextMenu1.MenuItems.Add("S&uspend Application");
   contextMenu1.MenuItems.Add("E&xit");

   // Set properties of NotifyIcon component.
   notifyIcon1.Visible = true;
   notifyIcon1.Icon = new System.Drawing.Icon
      (System.Environment.GetFolderPath
      (System.Environment.SpecialFolder.Personal)
      + @"\Icon.ico");
   notifyIcon1.Text = "Right-click me!";
   notifyIcon1.ContextMenu = contextMenu1;
}
nunespascal
  • 17,584
  • 2
  • 43
  • 46
  • 2
    I already have menu when right clicking on **tray** icon. Now I need to duplicate it for a button in **taskbar**. Different things. – Sergey Shafiev Aug 21 '12 at 08:25