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
The window size seems to be dependent on Desktop size, not screen resolution; however the Desktop conforms to resolution. The trick might be to change the Desktop size or start from there.
A while back, a developer named Robert Bresner (his website) made a product called sDesk (downloadable from here) which expanded Windows beyond the screen resolution.
What is SDesk? SDesk is not a multi-desktop program. It is a program that creates a single, giant desktop that extends beyond the visible region of the monitor. Only a portion of the SDesk is visible at a time, as defined by the Windows desktop settings.
The original homepage of the SDesk software is archived here There's no current page on the Internet (that I could find) but this archived version is accessed through the Way Back Machine which caches a lot of the Internet.
The SDesk product is freeware. No source code was included though. You might visit his contact page (also available in the archived version) to ask if the source is available or can be acquired for your research.
ok, I did try use keystrokes to move, resize windows. But system will automatically move windows back to visible region of desktop in my XP. I also tried SetWindowPos API, and no helps. The best chance will be to write a Video driver, but it may need more study. The 360 desktop claims you can expand desktop horizontally. But actually it just pan the current desktop in a virtual wider space. Any windows inside still have the size limitation of no larger than your screen resolution.
Video driver set the screen resolution(yes, have to compatibile to lcd/crt screen capability), and Windows did limit window-size by this thresholds. I just want to work around in user space API.
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;
}
You can do something like the following code in your WinProc();
case WM_GETMINMAXINFO:
{
LPMINMAXINFO lpmmi = (LPMINMAXINFO)lParam;
GetWindowRect(GetDesktopWindow(), &actualDesktop);
lpmmi->ptMaxTrackSize.x = 3000;// set the value that you really need.
lpmmi->ptMaxTrackSize.y = 3000;// set the value that you really need.
}
break;
An application can use this message to override the window's default maximized size and position, or its default minimum or maximum tracking size.
For the specific case of needing a more screen-friendly view of the MSDN, or on any other site (like StackOverflow) that makes poor use of screen real estate, I would suggest applying a custom stylesheet to the page, using a tool like IE7Pro (IE), Greasemonkey (Firefox), Stylish (Fireox), or the built in stylesheet picker in Opera.
I needed to push part of a window off the top of the screen and I was fnally able to do it using this AutoHotKey script:
SetTitleMatchMode, 2
WinTitle := "Visual Studio Code"
; --- WinMove version
; WinMove, %WinTitle%, , 0, -64, 1280, 1504
; -- DLL version
WinGet, id, , %WinTitle%
Result := DllCall("SetWindowPos", "uint", id, "uint", HWND_TOP, "Int", 0, "Int", -64, "Int", 1280, "Int", 1504, "UInt", 0x400)
(I wanted to maximize the editor area of VSCode by completely hiding the title bar and the tabs section, that are not configurable in the program itself.)