Заранее извиняюсь если не в том подфоруме создал тему.
Необходимо изменить размер окна рабочего стола, сделать его больше чем физическое разрешение монитора, иногда такой эффект получалось достичь случайно, при этом ширина панели задач была больше размера экрана и сам экран прокручивался, т.е. на экране была видна только часть окна рабочего стола. Надеюсь понятно обьяснил.
Поиском нашел товарищей по несчастью но и они не нашли решения:
автор"SystemParametersInfo(SPI_SETWORKAREA, 1, ref rc, 0);
But if new work area size is bigger than screen resolution it fails, that is logical. So I guess this is not the way do do it.
What I wanna do is change virtual screen size so that if I take "printscreen" it returns image with the size of "resized desktop". The same way if I take a printscreen when I plug-in two monitors it returns image with the size of both monitors, so the whole desktop area (primary and secondary area).
So in a way what I'm asking is, is there a way to extend desktop size (not using multiple virtual desktops)?
I know that when I sometimes set resolution settings on older windows editions, I sometimes had an option to set unsupported resolutions and what that did, it only extended the whole desktop so you can move up, down, left or right. That is exactly what I wanna do (without moving around desktop), so I just wanna know how to extend desktop size, I guess that means changing virtual screen resolution.
I hope I was clear enough. Thank you all."
http://social.msdn.microsoft.com/Forums/en/csharpgeneral/thread/841e14ff-a12e-49a0-a123-5a771d202225
Пытался так:
1.
2.
3.
4.
5.
6.
SetWindowPos(GetDesktopWindow,HWND_BOTTOM, 0 , 0 , 1920 , 1440 , 0 ); //больше размера экрана
Rect := Screen.WorkAreaRect;
Rect.Left:= 0 ;
Rect.Top:= 0 ;
Rect.Right:= 1920 ;
Rect.Bottom:= 1440 ;
SystemParametersInfo(SPI_SETWORKAREA, 0 , @Rect, 0 );
не помогло, наткнулся на проект virtualscreenmax
в частности
http://virtualscreenmax.codeplex.com/SourceControl/changeset/view/51827#784755
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
128.
129.
130.
131.
132.
133.
134.
135.
136.
137.
138.
139.
140.
141.
142.
143.
144.
145.
146.
147.
148.
149.
150.
151.
152.
153.
154.
155.
156.
157.
158.
159.
160.
161.
162.
163.
164.
165.
166.
167.
168.
169.
170.
171.
172.
173.
174.
175.
176.
177.
178.
179.
180.
181.
182.
183.
184.
185.
186.
187.
188.
189.
190.
191.
192.
193.
194.
195.
196.
197.
198.
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace VirtualScreenMaximizer
{
public class Maximizer
{
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool RegisterHotKey(IntPtr hWnd, int id, uint fsModifiers, uint vk);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool UnregisterHotKey(IntPtr hWnd, int id);
public static uint MOD_ALT = 0x1;
public static uint MOD_CONTROL = 0x2;
public static uint MOD_SHIFT = 0x4;
public static uint MOD_WIN = 0x8;
public static uint WM_HOTKEY = 0x312;
public static Dictionary<int, string> keyAssignments = new Dictionary<int, string>();
public static void RegisterHK(IntPtr handle, int hashCode, System.Windows.Forms.Keys key, uint modifiers, string command)
{
if (keyAssignments.ContainsKey(hashCode + (int) key))
{
return;
}
keyAssignments.Add(hashCode + (int) key, command);
RegisterHotKey(handle, hashCode + (int) key, modifiers, (uint) key);
}
public static void UnRegisterHK(IntPtr handle, int hashCode, System.Windows.Forms.Keys key)
{
if (!keyAssignments.ContainsKey(hashCode + (int) key))
{
return;
}
keyAssignments.Remove(hashCode + (int) key);
UnregisterHotKey(handle, hashCode + (int) key);
}
public static void ProcessHK(IntPtr wParam)
{
if (keyAssignments.ContainsKey(wParam.ToInt32()))
{
string command = keyAssignments [wParam.ToInt32()];
//exec wparam
Console.WriteLine("HotKey {0}", keyAssignments [wParam.ToInt32()]);
//FullScreen
switch (command)
{
case "FullScreen":
Maximizer.FullScreen();
break;
case "RestoreOriginal":
Maximizer.RestoreOriginal();
break;
}
}
}
[DllImport("user32.dll")]
static extern IntPtr GetForegroundWindow();
[DllImport("user32.dll", SetLastError = true)]
static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll")]
static extern int SetWindowLong(IntPtr hWnd, int nIndex, IntPtr dwNewLong);
[DllImport("user32.dll")]
static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);
static readonly int GWL_STYLE = (-16);
/*static readonly int GWL_WNDPROC = (-4);
static readonly int GWL_HINSTANCE = (-6);
static readonly int GWL_HWNDPARENT = (-8);
static readonly int GWL_EXSTYLE = (-20);
static readonly int GWL_USERDATA = (-21);
static readonly int GWL_ID = (-12);
static readonly uint GW_HWNDFIRST = 0;
static readonly uint GW_HWNDLAST = 1;
static readonly uint GW_HWNDNEXT = 2;
static readonly uint GW_HWNDPREV = 3;
static readonly uint GW_OWNER = 4;
static readonly uint GW_CHILD = 5;
static readonly uint GW_ENABLEDPOPUP = 6;
static readonly uint GW_MAX = 6;*/
static readonly uint WS_MAXIMIZEBOX = 0x10000;
public struct ConfiguredKey
{
public bool Alt;
public bool Control;
public bool Shift;
public int KeyCode;
public ConfiguredKey(bool a, bool c, bool s, int kc)
{
this.Alt = a;
this.Control = c;
this.Shift = s;
this.KeyCode = kc;
}
}
[StructLayout(LayoutKind.Sequential)]
public struct WINDOWPLACEMENT
{
public int length;
public int flags;
public int showCmd;
public System.Drawing.Point ptMinPosition;
public System.Drawing.Point ptMaxPosition;
public System.Drawing.Rectangle rcNormalPosition;
public static WINDOWPLACEMENT Default
{
get
{
WINDOWPLACEMENT result = new WINDOWPLACEMENT();
result.length = Marshal.SizeOf(result);
return result;
}
}
}
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool GetWindowPlacement(IntPtr hWnd, ref WINDOWPLACEMENT lpwndpl);
[DllImport("user32.dll")]
static extern bool SetWindowPlacement(IntPtr hWnd,[In] ref WINDOWPLACEMENT lpwndpl);
private static Dictionary<IntPtr, int> originalWinLongs = new Dictionary<IntPtr, int>();
private static Dictionary<IntPtr, WINDOWPLACEMENT> originalWindowPlacements = new Dictionary<IntPtr, WINDOWPLACEMENT>();
private static void FullScreen()
{
IntPtr fw = GetForegroundWindow();
int lngStyle = GetWindowLong(fw, GWL_STYLE);
if (!originalWinLongs.ContainsKey(fw))
{
originalWinLongs.Add(fw, lngStyle);
}
WINDOWPLACEMENT wp=new WINDOWPLACEMENT();
GetWindowPlacement(fw, ref wp);
if (!originalWindowPlacements.ContainsKey(fw))
{
originalWindowPlacements.Add(fw, wp);
}
lngStyle = (int) (lngStyle & ~WS_MAXIMIZEBOX);
lngStyle = (int) (lngStyle & ~0xC00000);
System.Drawing.Rectangle vSize = System.Windows.Forms.SystemInformation.VirtualScreen;
SetWindowLong(fw, GWL_STYLE, (IntPtr) lngStyle);
SetWindowPos(fw, IntPtr.Zero, vSize.Left, vSize.Top, vSize.Width, vSize.Height, 0);
}
private static void RestoreOriginal()
{
IntPtr fw = GetForegroundWindow();
if (originalWinLongs.ContainsKey(fw))
{
SetWindowLong(fw, GWL_STYLE, (IntPtr) originalWinLongs [fw]);
}
if (originalWindowPlacements.ContainsKey(fw))
{
WINDOWPLACEMENT wp=originalWindowPlacements[fw];
SetWindowPlacement(fw, ref wp);
}
}
}
}
как я понимаю где то тут изменяется размер virtual screen, но увы я слишком слабо понимаю .net,
может более опытные коллеги подскажут мне как конкретно увеличивается virtual screen?
заранее спасибо за внимание.