Create Window larger than desktop (display resolution)

后端 未结 9 2060
旧时难觅i
旧时难觅i 2021-01-12 03:47

I need to resize a window larger than screen resolution or size of desktop, programmatically & preferably also manually.

Since MS-Windows XP/Vista disallows a wi

9条回答
  •  天涯浪人
    2021-01-12 04:43

    This code in C# does what you ask. The window is way wider than the desktop.

     protected override void WndProc(ref Message m) {
            if (m.ToString().Contains("GETMINMAXINFO")) {
                //Hent data
                MINMAXINFO obj = (MINMAXINFO)Marshal.PtrToStructure(m.LParam, typeof(MINMAXINFO));
                //Endre
                if (obj.ptMaxSize.X > 0) {
                    obj.ptMaxSize.X = 60000;
                    obj.ptMaxSize.Y = 60000;
                    obj.ptMaxTrackSize.X = 60000;
                    obj.ptMaxTrackSize.Y = 60000;
                    //Oppdater
                    Marshal.StructureToPtr(obj, m.LParam, true);
                }
            }
            if (m.ToString().Contains("WINDOWPOSCHANGING")) {
                //Hent data
                WINDOWPOS obj = (WINDOWPOS)Marshal.PtrToStructure(m.LParam, typeof(WINDOWPOS));
                //Endre
                if (obj.cx > 0) {
                    obj.cx = 8000;
                    //Oppdater
                    Marshal.StructureToPtr(obj, m.LParam, true);
                }
            }
            //Debug.WriteLine(m.ToString());
            base.WndProc(ref m);
        }
    
    
    
    
    
    
    
    
    
    
    
        [StructLayout(LayoutKind.Sequential)]
        internal struct WINDOWPOS {
            internal IntPtr hwnd;
            internal IntPtr hWndInsertAfter;
            internal int x;
            internal int y;
            internal int cx;
            internal int cy;
            internal uint flags;
        }
    
        [StructLayout(LayoutKind.Sequential)]
        internal struct MINMAXINFO {
            internal POINT ptReserverd;
            internal POINT ptMaxSize;
            internal POINT ptMaxPosition;
            internal POINT ptMinTrackSize;
            internal POINT ptMaxTrackSize;
        }
        [StructLayout(LayoutKind.Sequential)]
        internal struct POINT {
            internal int X;
            internal int Y;
        }
    

提交回复
热议问题