public static SystemMenu FromWPFForm(Window form) { var cSysMenu = new SystemMenu(); cSysMenu.m_SysMenu = apiGetSystemMenu((new WindowInteropHelper(form)).Handle, 0); if (cSysMenu.m_SysMenu == IntPtr.Zero) { // Throw an exception on failure throw new NoSystemMenuException(); } return cSysMenu; }
// Retrieves a new object from a Form object public static SystemMenu FromForm(Form Frm) { SystemMenu cSysMenu = new SystemMenu(); cSysMenu.m_SysMenu = apiGetSystemMenu(Frm.Handle, 0); if (cSysMenu.m_SysMenu == IntPtr.Zero) { // Throw an exception on failure throw new NoSystemMenuException(); } return(cSysMenu); }