I need a way to hide or cancel opening the system menu when the user makes click on it (completely disable the menu is my last resort, I preffer to hide it)
Searching info about this in MSDN I've seen the DestroyMenu
API function: http://msdn.microsoft.com/en-us/library/windows/desktop/ms647631%28v=vs.85%29.aspx
<DllImport("user32.dll")>
Private Shared Function DestroyMenu(
ByVal hMenu As IntPtr)
End Function
But when I try it the system menu of the application loose the "Style" and is not "destroyed" (deleted).
Anyways I will keep in mind that what I would like to do is hide the menu or avoid the menu openning instead of completely disable it.
You can disable left clicking the icon, and right clicking anywhere in the title bar.
In your form designer, set the Form.ControlBox property to false.
This makes the menu disappear completely:
You can disable the different elements in code but the buttons seem to be tied to the menu so it doesn't seem possible to get rid of the menu without stopping the equivalent button working: