Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to programmatically move Windows taskbar?

I'd like to know any sort of API or workaround (e.g., script or registry) to move (or resize) Windows taskbar to another position including another monitor (if dual monitors). Definitely, we can move task bar by using mouse, but I want to move it by a program, or a sort of automated way.

I tried to find Win32 API, but it seems no one does this job.

EDIT: I was surprised by many people's opinion. Let me explain why I wanted it. In my workplace, I'm using dual monitors (resolutions are different), and the taskbar is placed on the left monitor while the primary monitor is the right monitor. However, I often connect to my workplace computer via remote desktop. After the remote connection, the taskbar position is switched. That's why I wanted to make a simple program that can save/restore taskbar's position. Everyday I have to rearrange my taskbar. That's it. I just want it for me.

like image 314
minjang Avatar asked Jan 14 '10 20:01

minjang


People also ask

Is it possible to relocate Windows taskbar?

Move the TaskbarRight-click an empty space on the taskbar, and then click to uncheck Lock the taskbar. The taskbar must be unlocked in order to move it. Click and drag the taskbar to the top, bottom, or side of your screen.

How do I move the taskbar in CMD?

Click a blank portion of the taskbar. Hold down the primary mouse button, and then drag the mouse pointer to the place on the screen where you want the taskbar. For example, you may want the taskbar to be positioned vertically on the right side of your screen.


1 Answers

I also have this need on Windows 7. Here is my take to do this using autohotkey script:

; This script will try to drag and move the taskbar to where the *current* mouse ; cursor is  ; 0x111: WM_COMMAND, 424: lock/unlock taskbar, http://www.codeproject.com/KB/miscctrl/Taskbar_Manipulation.aspx RegRead, TaskbarLocked, HKEY_CURRENT_USER, SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced, TaskbarSizeMove If TaskbarLocked = 0   SendMessage 0x111, 424, , , ahk_class Shell_TrayWnd     WinActivate ahk_class Shell_TrayWnd MouseGetPos targetX, targetY ControlGetPos x, y, w, h, MSTaskListWClass1, ahk_class Shell_TrayWnd MouseMove x+1, y+1 MouseClickDrag Left, x+1, y+1, targetX, targetY, 10  ; often after dragging the taskbar to left or right side of a monitor, even though ; there are enough room to show two columns of icons, it will only show one column, ; it seems showing or hiding an icon will fix this Menu, Tray, NoIcon Menu, Tray, Icon  ; lock the taskbar if it was previously locked If TaskbarLocked = 0   SendMessage 0x111, 424, , , ahk_class Shell_TrayWnd    

I have tested this on Windows 7 with classic window theme. To use this, assign a hotkey to call this script, then position mouse cursor to where you want to drag the taskbar to, then press the hotkey.

like image 83
wangzq Avatar answered Oct 12 '22 22:10

wangzq