How to open the window context menu (the usual Windows context that appears when you right-click the window title).
Things I tried (at the click of a button)
ReleaseCapture(); SendMessage(this.Handle, WM_NCRBUTTONDOWN, 0, 0); SendMessage(this.Handle, WM_RBUTTONUP, 0, 0); SendMessage(this.Handle, WM_CONTEXTMENU, 0, 0);
And this:
ReleaseCapture(); SendMessage(this.Handle, WM_NCRBUTTONDOWN, HT_CAPTION, 0); SendMessage(this.Handle, WM_RBUTTONUP, HT_CAPTION, 0); SendMessage(this.Handle, WM_CONTEXTMENU, HT_CAPTION, 0);
source share