2

Does anyone know if its actually possible to set the height of a window such that it is greater than the screen size using C#?

I tried something like this on several windows:

SetWindowPos(handle, new IntPtr(0), 0, 0, 1024, 4000, 
             SetWindowPosFlags.SWP_SHOWWINDOW);

However, they never go past the screen size - is there a way around this?

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
Abs
  • 56,052
  • 101
  • 275
  • 409
  • [This is something similar](http://stackoverflow.com/questions/2344615/how-to-increase-window-height-longer-than-the-screen-height-in-applescript). Although being for Apple, I do think the same applies for Windows. – Uwe Keim Dec 28 '11 at 13:01
  • I think the max height is enforced by the `WM_WINDOWPOSCHANGING` handler, so if you could override the window procedure, then you could call the default window proc and then alter the return value before returning. That said, you tagged this as "console-application", and I don't think you'll be able to override the window proc for a console window. – Joe White Dec 28 '11 at 13:29
  • possible duplicate of [Is the size of a Form in Visual Studio designer limited to screen resolution?](http://stackoverflow.com/questions/6651115/is-the-size-of-a-form-in-visual-studio-designer-limited-to-screen-resolution) – Cody Gray - on strike Dec 28 '11 at 13:33
  • No, you can't do this. There's no reason for a window to be larger than the screen. – Cody Gray - on strike Dec 28 '11 at 13:33
  • @CodyGray - this is possible. I've seen many applications do this. Furthermore, I think I'm the only person that can say if there is a need for this or not. :) – Abs Dec 28 '11 at 14:01
  • 1
    This can be controlled by an application by handling the WM_GETMINMAXINFO message. But you're messing with apps that are not yours, you'd need a window hook to trap that message. But WH_CALLWNDPROCRET is a global hook, you can't write those in C#. – Hans Passant Dec 28 '11 at 15:24
  • @HansPassant I too have seen JetVideo doing this, my max screen resolution is 1430x900 when I played a 1920x1060 video at 100% it stretched outside the screen and i could only see the clipped region of the window, so they could be using some hacks to do that. Could be looked into. – Shekhar_Pro Dec 29 '11 at 00:09
  • @Shekhar: Are you sure that the *window* was actually larger than the screen, rather than the video was just cut off? – Cody Gray - on strike Dec 29 '11 at 06:27
  • @CodyGray They have their custom designed window chrome and it was greater than max screen resolution.. I am not much experienced in using spy++ but you may try checking it. Take any small video convert it to a scaled video of greater resolution (use handbrake) and play it in JetVideo. – Shekhar_Pro Dec 29 '11 at 12:21

1 Answers1

1

No its not allowed though you are using SetWindowPos the MSDN docs on Form.Size property says:

The maximum value of this property is limited by the resolution of the screen on which the form runs. The value cannot be greater than 12 pixels over each screen dimension (horizontal + 12 and vertical + 12).

Shekhar_Pro
  • 18,056
  • 9
  • 55
  • 79
  • I've also used the `MoveWindow` and that too doesn't work. Are there any other alternatives? – Abs Dec 28 '11 at 13:24
  • @Abs One alternative seems to be mentioned in [this answer on SO](http://stackoverflow.com/a/6651523/399722) which suggests to use a Panel in the form. – Shekhar_Pro Dec 28 '11 at 13:31