internal static bool TrySetFormChildWindowStyle(Form form) { long newStyle = (long)USER32.GetWindowLongPtr(form.Handle, GWL_STYLE); if (newStyle == 0) { return(false); } newStyle = (newStyle | WS_CHILD) & ~WS_POPUP; return(USER32.SetWindowLongPtr(form.Handle, GWL_STYLE, (IntPtr)newStyle) != IntPtr.Zero); }