views:

896

answers:

3

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.

+6  A: 

This article gives you a walk through in C#!

Mitchel Sellers
A: 

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;
                }
        }
    }
C. Ross
But this wouldn't be integrated with the existing menu, if you simply show your menu.
Mitchel Sellers
A: 

I have created an app and used this code and it works nicely but I've run into a slight problem that goes one step further. I have created a context menu that is supposed to mimic the Windows System menu on right click. When right clicking the taskbar the context menu shows up, but the bottom of it stops at the top of the taskbar. The X position is perfect, but I would like the Y position to show over the taskbar like a normal Windows System Menu would. Is there any way to do this? Here is the code I put in instead of the MessageBox.Show from the above code.

contextMenuStrip.Show(Cursor.Position.X, Cursor.Position.Y);