using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; namespace llcom.Tools { class Win32 { [DllImport("user32.dll")] private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong); [DllImport("user32.dll")] private static extern int GetWindowLong(IntPtr hWnd, int nIndex); private const int GWL_STYLE = -16; private const int WS_SYSMENU = 0x80000; // 隐藏窗口右上角按钮 internal static bool HideControlBox(IntPtr hWnd) { return SetWindowLong(hWnd, GWL_STYLE, GetWindowLong(hWnd, GWL_STYLE) & ~WS_SYSMENU) > 0; } } }