Jump to content

[Example] Moving Windows 7 Taskbar (Should work on XP and Vista)


IanN1990
 Share

Recommended Posts

Hi,

For a long time now i wanted a way to move the windows 7 task bar between screens. Much to my research there is no simple way to do this and requires a very advanced level of programing. So for many months i settled with MouseClickDrag.

Problem is, the function is very slow and if you move your mouse during its run then things can go wrong.

MouseClickDrag Example - Moving Taskbar from Left to Right - Set for 1920x1080 res (Mouse Locations need to be changed for different sized screens)

WinActivate('[Class:Shell_TrayWnd]')
WinSetOnTop('[Class:Shell_TrayWnd]', '', 1)
MouseClickDrag("Left", 5, 975, 1915, 975, 0)
sleep(1000)
WinActivate('[Class:Shell_TrayWnd]')
WinSetOnTop('[Class:Shell_TrayWnd]', '', 1)
MouseClickDrag("Left", 1915, 975, 5, 975, 0)

Here is my new improved version. Click&Drag Takes 1.009 to run, is visible and can be bugged out easily. This new code runs at .400, is instant and doesn't bugg.

MoveTaskbar("Right")
sleep(1000)
MoveTaskbar("Left")

Func MoveTaskbar($Direction)
WinActivate('[Class:Shell_TrayWnd]') ;Makes Taskbar Appear if its set to Auto-Hide
WinSetOnTop('[Class:Shell_TrayWnd]', '', 1) ;Sets it ontop incase an application is over it
If $Direction = "Right" Then
MouseMove(5, 975, 0) ;Moves to Taskbar
MouseDown ( "left" ) ;Holds Left Mouse down
MouseMove(1915,975,0) ;Moves Mouse to new Location
sleep(1) ;Is needed for this to work
MouseMove(1915,925,0) ;Moves the Taskbar
ElseIf $Direction = "Left" Then
MouseMove(1915, 975, 0)
MouseDown ( "left" )
MouseMove(5,975,0)
sleep(1)
MouseMove(5,925,0)
EndIf
    MouseUp ( "left" ) ;Releases the Mouse
EndFunc

I know this code isnt very complex, and prob isn't the best thing with Example but i hope it helps someone.

The only tip i can suggest is setting the first mousemove just above [Class:TrayNotifyWnd] in the Taskbar. Setting it high means it could "click a application" making the code fail.

Edited by IanN1990
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...