Is it possible to fetch a System.Windows.Forms.ContextMenu instance from a handle? By fetch I mean building it up from the handle, reading each item, etc.
Attention, this is not a System.Windows.Forms.ContextMenuStrip.
Been asked to give more info:
I want to retrieve this menu because I have a natively borderless form on which I draw custom borders and I wish to keep the form’s original system menu.
Ah, your edit makes it clear: you have an HMENU of a window’s system menu, and you want to show that context menu.
But why on earth do you want to drag the WinForms ContextMenu class into the mix? It’s meant for building your own menus and writing .NET code to react to their click events. It’s not suited for system menus, which are already populated and already have all the click handling baked in.
If you already have an HMENU for the system menu, then all you need to do is tell the Windows API to show it as a context menu. You would do that by P/Invoking to TrackPopupMenu.