Sign in to follow this  
Followers 0
IanN1990

Windows 7 - Move Taskbar

7 posts in this topic

#1 ·  Posted (edited)

A Function to Move the Windows 7 Taskbar.

; #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 by IanN1990

Share this post


Link to post
Share on other sites



So you finally came up with a method.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_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 parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

Can't get it working ! ( win7 x64)

For each move i get :

Posted Image


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

@wakillon

In the french version replace the {m} by {l} and it will work.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

@wakillon

In 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.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

#7 ·  Posted (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 by Dimark

Share this post


Link to post
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
Sign in to follow this  
Followers 0