mirror of
https://github.com/kangyu-california/PersistentWindows.git
synced 2025-05-11 21:15:38 +02:00
fix issue #236: automatically toggle taskbar lock to restore taskbar position
This commit is contained in:
parent
3ca20b0219
commit
543d56c540
2 changed files with 11 additions and 0 deletions
|
@ -3028,12 +3028,21 @@ namespace PersistentWindows.Common
|
|||
|
||||
if (IsTaskBar(hWnd))
|
||||
{
|
||||
int taskbarMovable = (int)Registry.GetValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarSizeMove", 1);
|
||||
if (taskbarMovable == 0)
|
||||
{
|
||||
User32.SendMessage(hWnd, User32.WM_COMMAND, User32.SC_TOGGLE_TASKBAR_LOCK, IntPtr.Zero);
|
||||
}
|
||||
bool changed_edge = MoveTaskBar(hWnd, rect);
|
||||
bool changed_width = false;
|
||||
if (!remoteSession || restoringFromDB || restoringSnapshot)
|
||||
changed_width = RecoverTaskBarArea(hWnd, rect);
|
||||
if (changed_edge || changed_width)
|
||||
restoredWindows.Add(hWnd);
|
||||
if (taskbarMovable == 0)
|
||||
{
|
||||
User32.SendMessage(hWnd, User32.WM_COMMAND, User32.SC_TOGGLE_TASKBAR_LOCK, IntPtr.Zero);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -439,8 +439,10 @@ namespace PersistentWindows.Common.WinApiBridge
|
|||
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto)]
|
||||
public static extern IntPtr SendMessage(IntPtr hWnd, int Msg, int wParam, IntPtr lParam);
|
||||
public const int WM_COMMAND = 0x0111;
|
||||
public const int WM_SYSCOMMAND = 0x0112;
|
||||
public const int SC_MINIMIZE = 0xF020;
|
||||
public const int SC_TOGGLE_TASKBAR_LOCK = 424;
|
||||
|
||||
#region Hooks
|
||||
[DllImport("user32.dll")]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue