Window sizes might be enforced passively or actively by a program. For example, to resize the "Computer Management" window (which always runs elevated), this program would have to run elevated as well.
#ENABLE DESKTOP RESIZING OR WINDOWS#
An executable can only interact with windows at or below its own security context.
Starting with Windows Vista, Microsoft has implemented increasing security around window messages. This approach is generally functional, but there are a number of limitations that might prevent a window from being resized, or resized in any useful manner. SetWindowPos(hwnd, TOP, 0, 0, 6000, 6000, NOCOPYBITS | NOSENDCHANGING | SHOWWINDOW) Var hwnd = FindWindow(null, "Untitled - Notepad") Uint SHOWWINDOW = 0x0040, NOCOPYBITS = 0x0100, NOSENDCHANGING = 0x0400 Public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int left, int top, int width, int height, uint flags) Public static extern IntPtr FindWindow(String className, String windowName) The following is a tiny example program that will resize Notepad to 6000圆000 (change the string "Untitled - Notepad" to the title of the window you want to resize, or take the window name and desired size from the command line args) namespace Example Any other sizing of the window will cause the restriction to snap the window back to desktop restricted sizes, as the message will be sent and the window size enforced. This will prevent the WM_WINDOWPOSCHANGING message from being sent which is what triggers the WM_GETMINMAXINFO restriction. _in UINT uFlags // ** SWP_NOSENDCHANGING must be passed here ** If you would like to resize a window that you do not own (and without using any kind of hook), you can use the Windows SetWindowPos API with the SWP_NOSENDCHANGING (0x0400) flag set: BOOL WINAPI SetWindowPos(