🔀 禁用窗口最大化
This commit is contained in:
@@ -63,6 +63,21 @@ namespace GeekDesk.Util
|
||||
[DllImport("user32.dll")]
|
||||
static extern int GetWindowText(IntPtr hWnd, StringBuilder text, int count);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
|
||||
[DllImport("user32.dll")]
|
||||
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
|
||||
|
||||
|
||||
private const int GWL_STYLE = -16;
|
||||
private const int WS_MAXIMIZEBOX = 0x10000;
|
||||
public static void DisableMaxWindow(Window window)
|
||||
{
|
||||
var hwnd = new WindowInteropHelper(window).Handle;
|
||||
var value = GetWindowLong(hwnd, GWL_STYLE);
|
||||
SetWindowLong(hwnd, GWL_STYLE, (int)(value & ~WS_MAXIMIZEBOX));
|
||||
}
|
||||
|
||||
|
||||
public static void SetOwner(Window window, Window parentWindow)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user