开发者

Complicated Windows desktop size increase

i want to increase desktop size (programically), effect should be like attaching second monitor, on the primary monitor nothing should change after increase.

Such trick is needed to hide window off screen and then using PrintScreen get that window image, cutting it from whole screen.

P.s. PrintWindow() functio开发者_运维知识库n wont help here, i want to capture somewhere hidden webcam preview image, which isn't overlay, but still "Activemovie Window" gives me black image.

If u dont believe me, try capturing hidden Windows Messanger preview screen, at tools->Audio tuning Wizard...


Hmm... You could write a video driver, that should do the trick. (The reason why just moving the window offscreen doesn't work is because most programs don't re-paint the entire window - only the "damaged portion" - and even then, the device context might not remember the contents if it's drawn to video memory).


Here is a code in C# that made me be able to resize my form to way bigger than the desktop area defined by my 3 monitors. I used the DrawToBitmap after a random backgroundcolor setting to see if the nonvisible part of the window got painted, and it seems so. You just do the same in C to get the same result. Hooking etc if needed.

   protected override void WndProc(ref Message m) {
        if (m.ToString().Contains("GETMINMAXINFO")) {
            //Get data
            MINMAXINFO obj = (MINMAXINFO)Marshal.PtrToStructure(m.LParam, typeof(MINMAXINFO));
            //Change
            if (obj.ptMaxSize.X > 0) {
                obj.ptMaxSize.X = 60000;
                obj.ptMaxSize.Y = 60000;
                obj.ptMaxTrackSize.X = 60000;
                obj.ptMaxTrackSize.Y = 60000;
                //Update
                Marshal.StructureToPtr(obj, m.LParam, true);
            }
        }
        if (m.ToString().Contains("WINDOWPOSCHANGING")) {
            //Get data
            WINDOWPOS obj = (WINDOWPOS)Marshal.PtrToStructure(m.LParam, typeof(WINDOWPOS));
            //Change
            if (obj.cx > 0) {
                obj.cx = 8000;
                //Update
                Marshal.StructureToPtr(obj, m.LParam, true);
            }
        }
        //Debug.WriteLine(m.ToString());
        base.WndProc(ref m);
    }

    [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;
    }



    [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;
    }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜