IanN1990 Posted February 19, 2013 Share Posted February 19, 2013 (edited) A Function to Move the Windows 7 Taskbar. expandcollapse popup; #FUNCTION# ==================================================================================================================== ; Name ..........: _MoveTaskBar ; Description ...: Moves the Windows 7 Taskbar to a New Location on the Screen. ; Syntax ........: _MoveTaskBar([$ScreenPosX [, $ScreenPosY = '']]) ; Parameters ....: $ScreenPosX = Left, Right, Top, Bottom ; or $ScreenPosX And $ScreenPosY = New Window Location ; Return values .: Success - True ; Failure - False ; Author ........: IanN1990 ; Remarks .......: ; Example .......: ; Note ..........: ; =============================================================================================================================== Func _MoveTaskBar($ScreenPosX, $ScreenPosY='') Local $LockState = RegRead("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarSizeMove") ;Get Lock State Local $TaskBarPos = WinGetPos('[Class:Shell_TrayWnd]') ;Get Current TaskBar State If Not $LockState Then DllCall("user32.dll", "lresult", "SendMessageW", "hwnd", WinGetHandle("[CLASS:Shell_TrayWnd]"), "uint", 273, "wparam", 424, "lparam", 0) ;Unlock Taskbar ControlSend('[Class:Shell_TrayWnd]', '', '', '!{Space}' & '{m}' & '{Up}') ;Prepare TaskBar For Movement If $ScreenPosX = 'Left' Then MouseMove(0, @DesktopHeight/2, 0) ElseIf $ScreenPosX = 'Right' Then MouseMove(@DesktopWidth/1.25, @DesktopHeight/2, 0) ElseIf $ScreenPosX = 'Top' Then MouseMove(@DesktopWidth/2, 0, 0) Elseif $ScreenPosX = 'Bottom' Then MouseMove(@DesktopWidth/2, @DesktopHeight, 0) ElseIf IsNumber($ScreenPosX) And IsNumber($ScreenPosY) Then MouseMove($ScreenPosX, $ScreenPosY, 0) EndIf ControlSend('[Class:Shell_TrayWnd]', '', '', '{Enter}') ;Complete Movemenet ControlHide('[Class:Shell_TrayWnd]', '', '[CLASS:TrayClockWClass; INSTANCE:1]') ;Refresh Icons To New Location ControlShow('[Class:Shell_TrayWnd]', '', '[CLASS:TrayClockWClass; INSTANCE:1]') If Not $LockState Then DllCall("user32.dll", "lresult", "SendMessageW", "hwnd", WinGetHandle("[CLASS:Shell_TrayWnd]"), "uint", 273, "wparam", 424, "lparam", 1) ;Relock Taskbar Local $NewTaskBarPos = WinGetPos('[Class:Shell_TrayWnd]') ;Get New TaskBar State If IsArray($TaskBarPos) And IsArray($NewTaskBarPos) And Not($TaskBarPos[0]+$TaskBarPos[1]=$NewTaskBarPos[0]+$NewTaskBarPos[1]) Then Return 1 ;Sucess Else Return 0 ;Failure EndIf EndFunc Example #Region Varaibles #NoTrayIcon #AutoIt3Wrapper_AU3Check_Parameters=-w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w7 #AutoIt3Wrapper_UseUpx=n Opt('SendKeyDelay', 0) #EndRegion _MoveTaskBar('Left') ;Move to Left Side of Main Screen Sleep(1250) _MoveTaskBar('Right') ;Move to Right Side of Main Screen Sleep(1250) _MoveTaskBar('Bottom') ;Move to Bottom of Main Screen Sleep(1250) _MoveTaskBar('Top') ;Move to Top of Main Screen Sleep(1250) _MoveTaskBar(960, 0) ;Move to Top Screen, on a 1920 / 1080 Resoulation. This function can be used for muti-moitor screens. Edited February 19, 2013 by IanN1990 Link to comment Share on other sites More sharing options...
guinness Posted February 19, 2013 Share Posted February 19, 2013 So you finally came up with a method. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
wakillon Posted February 19, 2013 Share Posted February 19, 2013 Can't get it working ! ( win7 x64)For each move i get : AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
PlayHD Posted February 19, 2013 Share Posted February 19, 2013 Good job. But in Windows 8 does not work. My UDF : _WinShake, _WinSplitMy Apps : Google Guitar Bot, PuzzleGameDesign Gui : Interesting Tabs Design, RBox Project (abandoned), Animated Gui on Exit Link to comment Share on other sites More sharing options...
FireFox Posted February 19, 2013 Share Posted February 19, 2013 @wakillon In the french version replace the {m} by {l} and it will work. Link to comment Share on other sites More sharing options...
wakillon Posted February 19, 2013 Share Posted February 19, 2013 @wakillonIn the french version replace the {m} by {l} and it will work.Good suggestion, works fine now !Merci ! AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
Dimark Posted August 15, 2014 Share Posted August 15, 2014 (edited) Hi, in the german windows version, I have the same problem like "wallkion", but I could'nt solve it by replacing {m} by {i}. What combination do I need ? Edited August 15, 2014 by Dimark Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now