How to programmatically move Windows taskbar?

前端 未结 6 689
无人及你
无人及你 2021-02-06 23:32

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).

6条回答
  •  青春惊慌失措
    2021-02-07 00:26

    I've had some luck with this task in an AutoHotkey script, just in case you don't care about the language used. It uses simulated keystrokes and mouse movements to move your taskbar. I stopped short of automatically unlocking/locking the taskbar.

    The hard part was getting it to work reliably. A lot of the code is dedicated to making sure that the taskbar moved. It still doesn't work 100%... it fails like 10% of the time from what I've seen. However, it should be good enough to get you started!

    If I ever come back to this script to make it work perfectly, I'll repost here.

    Here is the example script (highlighting is a bit odd here, as the language is AHK):

    F3::
        reload
    return
    
    F5::
        MoveTaskbar(2,"bottom")
    return
    
    F6::
        MoveTaskbar(2,"left")
    return
    
    F7::
        MoveTaskbar(1,"top")
    return
    
    ; Move the taskbar
    ; dspNumber:    number.  device number (primary display is 1, secondary display is 2...)
    ; edge:         string.  Top, Right, Bottom, or Left
    MoveTaskbar(dspNumber, edge)
    {
        Critical 
        OutputDebug MoveTaskbar - called to move taskbar to display #%dspNumber% ("%edge%" edge)
    
        ; absolute coordinate system
        CoordMode, Mouse, Screen
    
        ; error checking for dspNumber
        SysGet, numMonitors, MonitorCount
        if (numMonitors

提交回复
热议问题