Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add to right click application menu in taskbar in .NET

Most applications only have "Restore, Move, Size, Minimize, Maximize and Close", however MS SQL offers extra options "Help, Customize view". Along those lines, is it possible to add to the right click menu of an application in the task bar?

Note: I'm not referring to an icon in the notification area next to the clock.

like image 735
BrianH Avatar asked Sep 30 '08 15:09

BrianH


People also ask

How do I customize my taskbar apps?

Pin an app from StartIn the search box on the taskbar, type the name of the app you want to pin to the taskbar. Right-click on the app, then select Pin to taskbar. To unpin an app, follow the same steps and select Unpin from taskbar.


1 Answers

This is a simpler answer I found. I quickly tested it and it works.

My code:

    private const int WMTaskbarRClick = 0x0313;

    protected override void WndProc(ref Message m)
    {
        switch (m.Msg)
        {
            case WMTaskbarRClick:
                {
                    // Show your own context menu here, i do it like this
                    // there's a context menu present on my main form so i use it

                    MessageBox.Show("I see that.");

                    break;
                }
            default:
                {
                    base.WndProc(ref m);
                    break;
                }
        }
    }
like image 138
C. Ross Avatar answered Oct 12 '22 22:10

C. Ross