ZoltanE Posted February 16, 2010 Posted February 16, 2010 Here is my toolbar implementation:expandcollapse popup; ------------------------------------- ; ----- My Photoshop toolbar v1.0 ----- ; ----- by Zoltan Erdokovy ----- ; ------------------------------------- ; ----- www.zspline.net ----- ; ------------------------------------- #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #Region ### START Koda GUI section ### Form=.\mypstoolbar.kxf ; This main window was made manually, the one Koda exports is not used. ; Koda can not set these particular dimension for the main container: ; the apperaing scroll bars screw things up. Global $hToolbar = GUICreate("ToolBar", 730, 66, 0, 0, BitOR($WS_POPUP,$WS_BORDER), BitOR($WS_EX_TOOLWINDOW,$WS_EX_TOPMOST)) ; The rest of the Koda section bellow is as it was generated. GUISetBkColor(0xD6D6D6) $DragLabel = GUICtrlCreatePic("d:\!projects\mypstoolbar\DragArea.bmp", 0, 0, 9, 66, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) GUICtrlSetCursor (-1, 9) $_New = GUICtrlCreateButton("_New", 10, 2, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_60.bmp", -1, 0) GUICtrlSetTip(-1, "New image") $_Open = GUICtrlCreateButton("_Open", 35, 2, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_61.bmp", -1) GUICtrlSetTip(-1, "Open file") $_Save = GUICtrlCreateButton("_Save", 60, 2, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_62.bmp", -1) GUICtrlSetTip(-1, "Save file") $_Saveas = GUICtrlCreateButton("_Saveas", 85, 2, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_63.bmp", -1) GUICtrlSetTip(-1, "Save file as") $_Exportpng = GUICtrlCreateButton("_Exportpng", 110, 2, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_64.bmp", -1) GUICtrlSetTip(-1, "Texture export to PNG") $_Exporttga = GUICtrlCreateButton("_Exporttga", 135, 2, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_66.bmp", -1) GUICtrlSetTip(-1, "Texture export to TGA") $_Exportweb = GUICtrlCreateButton("_Exportweb", 160, 2, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_65.bmp", -1) GUICtrlSetTip(-1, "Save for web") $_Showgrid = GUICtrlCreateButton("_Showgrid", 195, 2, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_67.bmp", -1) GUICtrlSetTip(-1, "Toggle grid") $_Snaptogrid = GUICtrlCreateButton("_Snaptogrid", 220, 2, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_68.bmp", -1) GUICtrlSetTip(-1, "Toggle grid snap") $_Showguides = GUICtrlCreateButton("_Showguides", 245, 2, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_69.bmp", -1) GUICtrlSetTip(-1, "Toggle guides") $_Snaptoguides = GUICtrlCreateButton("_Snaptoguides", 270, 2, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_70.bmp", -1) GUICtrlSetTip(-1, "Toggle guides snap") $_Gridsetup = GUICtrlCreateButton("_Gridsetup", 295, 2, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_71.bmp", -1) GUICtrlSetTip(-1, "Grid and guides setup") $_Offset = GUICtrlCreateButton("_Offset", 535, 2, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_72.bmp", -1) GUICtrlSetTip(-1, "Offset") $_Resize = GUICtrlCreateButton("Button4", 560, 2, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_76.bmp", -1) GUICtrlSetTip(-1, "Resize") $_Rotateleft = GUICtrlCreateButton("Button5", 590, 2, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_73.bmp", -1) GUICtrlSetTip(-1, "Rotate left") $_Rotateright = GUICtrlCreateButton("Button1", 615, 2, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_74.bmp", -1) GUICtrlSetTip(-1, "Rotate right") $_Rotatefree = GUICtrlCreateButton("Button2", 640, 2, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_75.bmp", -1) GUICtrlSetTip(-1, "Free rotate") $_Mirrorh = GUICtrlCreateButton("Button3", 670, 2, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_77.bmp", -1) GUICtrlSetTip(-1, "Horizontal mirror") $_Mirrorv = GUICtrlCreateButton("Button4", 695, 2, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_78.bmp", -1) GUICtrlSetTip(-1, "Vertical mirror") $_Crop = GUICtrlCreateButton("Button5", 500, 2, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_16.bmp", -1) GUICtrlSetTip(-1, "Crop") $_Move = GUICtrlCreateButton("Button1", 10, 38, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_01.bmp", -1) GUICtrlSetTip(-1, "Move tool") $_Selectpath = GUICtrlCreateButton("Button2", 35, 38, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_02.bmp", -1) GUICtrlSetTip(-1, "Path select tool") $_Selectrect = GUICtrlCreateButton("Button3", 65, 38, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_07.bmp", -1) GUICtrlSetTip(-1, "Rectangle selection") $_Lasso = GUICtrlCreateButton("Button4", 90, 38, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_11.bmp", -1) GUICtrlSetTip(-1, "Lasso") $_Lassopoly = GUICtrlCreateButton("Button5", 115, 38, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_12.bmp", -1) GUICtrlSetTip(-1, "Poly lasso") $_Lassomagnet = GUICtrlCreateButton("Button1", 140, 38, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_13.bmp", -1) GUICtrlSetTip(-1, "Magnetic lasso") $_Quickselect = GUICtrlCreateButton("Button2", 165, 38, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_14.bmp", -1) GUICtrlSetTip(-1, "Quick select") $_Magicwand = GUICtrlCreateButton("Button3", 190, 38, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_15.bmp", -1) GUICtrlSetTip(-1, "Magicwand") $_Spothealing = GUICtrlCreateButton("Button4", 225, 38, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_23.bmp", -1) GUICtrlSetTip(-1, "Spot healing tool") $_Healing = GUICtrlCreateButton("Button5", 250, 38, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_24.bmp", -1) GUICtrlSetTip(-1, "Healing tool") $_Patch = GUICtrlCreateButton("Button1", 275, 38, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_25.bmp", -1) GUICtrlSetTip(-1, "Patch") $_Clone = GUICtrlCreateButton("Button2", 300, 38, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_32.bmp", -1) GUICtrlSetTip(-1, "Clone stamp") $_Brush = GUICtrlCreateButton("Button3", 335, 38, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_27.bmp", -1) GUICtrlSetTip(-1, "Brush") $_Pencil = GUICtrlCreateButton("Button4", 360, 38, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_28.bmp", -1) GUICtrlSetTip(-1, "Pencil") $_Eraserback = GUICtrlCreateButton("Button5", 460, 38, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_35.bmp", -1) GUICtrlSetTip(-1, "Background eraser") $_Erasermagic = GUICtrlCreateButton("Button1", 485, 38, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_36.bmp", -1) GUICtrlSetTip(-1, "Magic eraser") $_Blur = GUICtrlCreateButton("Button2", 520, 38, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_39.bmp", -1) GUICtrlSetTip(-1, "Blur tool") $_Sharpen = GUICtrlCreateButton("Button3", 545, 38, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_40.bmp", -1) GUICtrlSetTip(-1, "Sharpen tool") $_Smudge = GUICtrlCreateButton("Button4", 570, 38, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_41.bmp", -1) GUICtrlSetTip(-1, "Smudge tool") $_Gradient = GUICtrlCreateButton("Button5", 435, 38, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_38.bmp", -1) GUICtrlSetTip(-1, "Gradient tool") $_Pen = GUICtrlCreateButton("_Pen", 385, 38, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_45.bmp", -1) GUICtrlSetTip(-1, "Pen") $_Paintbucket = GUICtrlCreateButton("_Paintbucket", 410, 38, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_37.bmp", -1) GUICtrlSetTip(-1, "Paint bucket") $_Layernew = GUICtrlCreateButton("_Layernew", 330, 2, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_80.bmp", -1) GUICtrlSetTip(-1, "New layer") $_Layercopy = GUICtrlCreateButton("_Layercopy", 355, 2, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_81.bmp", -1) GUICtrlSetTip(-1, "New layer via copy") $_Groupmake = GUICtrlCreateButton("_Groupmake", 380, 2, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_83.bmp", -1) GUICtrlSetTip(-1, "Group from layers") $_Mergedown = GUICtrlCreateButton("_Mergedown", 405, 2, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_84.bmp", -1) GUICtrlSetTip(-1, "Merge down") $_Mergevisible = GUICtrlCreateButton("_Mergevisible", 430, 2, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_86.bmp", -1) GUICtrlSetTip(-1, "Merge visible") $_Layerdelete = GUICtrlCreateButton("_Layerdelete", 465, 2, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_87.bmp", -1) GUICtrlSetTip(-1, "Delete layer") $_FBlurgauss = GUICtrlCreateButton("_FBlurgauss", 600, 38, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_88.bmp", -1) GUICtrlSetTip(-1, "Gaussian blur") $_FBlursmart = GUICtrlCreateButton("_FBlursmart", 625, 38, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_89.bmp", -1) GUICtrlSetTip(-1, "Smart blur") $_FSharpen = GUICtrlCreateButton("_FSharpen", 650, 38, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_90.bmp", -1) GUICtrlSetTip(-1, "Sharpen filter") $_FFilterforge = GUICtrlCreateButton("_FFilterforge", 675, 38, 26, 26, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, ".\Icons_91.bmp", -1) GUICtrlSetTip(-1, "FilterForge") $HorizontalLine = GUICtrlCreatePic("", 12, 32, 708, 1, BitOR($SS_NOTIFY,$WS_GROUP,$WS_BORDER,$WS_CLIPSIBLINGS)) GUICtrlSetState(-1, $GUI_DISABLE) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Opt("WinTitleMatchMode", 2) Global $bToolBar_OnTop = True ; Store "AlwaysOnTop" state. Global $aLastPos[2] ; Last position of the target app. Global $iLastAppState = 0 ; Last window state of the target app. Global $aOffset[2] ; The toolbar's offset relative to the target app. Global $aMouseInfo ; Mouse info. Global $aMouseLastPos[2] ; Previous position of the mouse. Global $aMouseDelta[2] ; The relative movement of the maouse since last check. Global $sMain_Title = "Adobe Photoshop CS" ; The (partial) name of the target application. Global $hApplication = WinGetHandle($sMain_Title) ; Target app window handle. Global $iApplication_PID = WinGetProcess($sMain_Title) ; Target app process ID. Global $aApplicationPos ; The position of the target app. Global $aToolbarPos ; The position of the toolbar. $aApplicationPos = WinGetPos($hApplication) ; Get target app position. $aMouseDelta[0] = 0 $aMouseDelta[1] = 0 $aOffset[0] = 985 ; Initial toolbar offset, X. $aOffset[1] = 4 ; Initial toolbar offset, Y. If Not ProcessExists($iApplication_PID) Then Exit ; Check Application is running. WinActivate($sMain_Title) ; If its running then activate it. WinWaitActive($sMain_Title) WinMove($hToolbar, '', $aApplicationPos[0] + $aOffset[0], $aApplicationPos[1] + $aOffset[1]) ; Move toolbar to desired position. Toolbar_Follow() While 1 If Not ProcessExists($iApplication_PID) Then Exit ; Exit if the target app is not running. Toolbar_State() ; Toggle "AlwaysOnTop" setting as required. Local $iMsg = GUIGetMsg() ; Check if an event has happened on the UI. If $iMsg Then Switch $iMsg ; Handle controls. Case $_New WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("^n") Case $_Open WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("^o") Case $_Save WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("^s") Case $_Saveas WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("+^s") Case $_Exportpng WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("^!+{-}") Case $_Exporttga WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("^!+{=}") Case $_Exportweb WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("^!+s") Case $_Showgrid WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("^{'}") Case $_Snaptogrid WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("^!+{F1}") Case $_Showguides WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("^{;}") Case $_Snaptoguides WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("^!+{F2}") Case $_Gridsetup WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("^!+{F3}") Case $_Offset WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("^!+{F4}") Case $_Resize WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("^!i") Case $_Rotateleft WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("^!+{F5}") Case $_Rotateright WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("^!+{F6}") Case $_Rotatefree WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("^!+{F7}") Case $_Mirrorh WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("^!+{F8}") Case $_Mirrorv WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("^!+{F9}") Case $_Crop WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("c") Case $_Layernew WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("^+n") Case $_Layercopy WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("^j") Case $_Groupmake WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("^!+{'}") Case $_Mergedown WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("^e") Case $_Mergevisible WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("^+e") Case $_Layerdelete WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("^+{'}") Case $_Move WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("v") Case $_Selectpath WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("a") Case $_Selectrect WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("m") Case $_Lasso WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("l") Case $_Lassopoly WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("d") Case $_Lassomagnet WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("f") Case $_Quickselect WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("k") Case $_Magicwand WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("w") Case $_Spothealing WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("j") Case $_Healing WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("n") Case $_Patch WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("r") Case $_Clone WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("s") Case $_Brush WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("b") Case $_Pencil WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("q") Case $_Pen WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("p") Case $_Paintbucket WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("t") Case $_Gradient WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("g") Case $_Eraserback WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("e") Case $_Erasermagic WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("y") Case $_Blur WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("o") Case $_Sharpen WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("z") Case $_Smudge WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("h") Case $_FBlurgauss WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("^!+{F10}") Case $_FBlursmart WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("^!+{F11}") Case $_FSharpen WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("^!+{F12}") Case $_FFilterforge WinActivate($sMain_Title) WinWaitActive($sMain_Title) Send("^!+{`}") Case $DragLabel $aMouseInfo = GUIGetCursorInfo($hToolbar) $aMouseLastPos[0] = $aMouseInfo[0] $aMouseLastPos[1] = $aMouseInfo[1] While $aMouseInfo[2] = 1 ; While LMB is held down... $aToolbarPos = WinGetPos($hToolbar) ; Get actual toolbar position. $aMouseInfo = GUIGetCursorInfo($hToolbar) ; Get mouse info. $aMouseDelta[0] = $aMouseInfo[0] - $aMouseLastPos[0] ; Get relative mouse movement on X. $aMouseDelta[1] = $aMouseInfo[1] - $aMouseLastPos[1] ; Get relative mouse movement on Y. $aOffset[0] = $aOffset[0]+$aMouseDelta[0] ; Modify the target app relative offset on X. $aOffset[1] = $aOffset[1]+$aMouseDelta[1] ; Modify the target app relative offset on Y. WinMove($hToolbar, '', $aToolbarPos[0] + $aMouseDelta[0], $aToolbarPos[1] + $aMouseDelta[1]) ; Move the toolbar. WEnd WinActivate($hApplication) ; Switch back to the target app. EndSwitch EndIf WEnd Func Toolbar_Follow() $aApplicationPos = WinGetPos($hApplication) If $aApplicationPos <> 0 then ; If the target app is still around... If $aApplicationPos[0] <> $aLastPos[0] Or $aApplicationPos[1] <> $aLastPos[1] Then ; If the target app has moved... $aLastPos[0] = $aApplicationPos[0] ; Store actual X position. $aLastPos[1] = $aApplicationPos[1] ; Store actual Y position. WinMove($hToolbar, '', $aApplicationPos[0] + $aOffset[0], $aApplicationPos[1] + $aOffset[1]) ; Relocate the toolbar. EndIf EndIf EndFunc Func Toolbar_State() Local $iActAppState = 0 Local $iActToolbarState = 0 Sleep(50) $iActAppState = WinGetState($hApplication) ; Get actual state of the target app. $iActToolbarState = WinGetState($hToolbar) ; Get actual state of the toolbar. If BitAND($iActAppState, 16) = 16 Then ; If the target app is minimised... If $iActAppState <> $iLastAppState Then ; If state has changed recently... WinSetState($hToolbar, "", @SW_HIDE) ; Hide toolbar. $iLastAppState = $iActAppState ; Store window state for future reference. EndIf Else ; If the target app is not minimised... If BitAND($iActAppState, 8) <> 8 Then ; If the target app is not active... If $iActAppState <> $iLastAppState Then ; If state has changed recently... If BitAND($iActToolbarState, 8) <> 8 Then ; If the now active window is not the toolbar... WinSetOnTop($hToolbar,"",0) ; Turn off "AlwaysOnTop". EndIf $iLastAppState = $iActAppState ; Store window state for future reference. EndIf ElseIf BitAND($iActAppState, 8) = 8 Then ; If target app is active... If $iActAppState <> $iLastAppState Then ; If state has changed recently... WinSetState($hToolbar, "", @SW_SHOW) ; Show toolbar. WinSetOnTop($hToolbar,"",1) ; Turn on "AlwaysOnTop". $iLastAppState = $iActAppState ; Store window state for future reference. EndIf Toolbar_Follow() ; Reposition toolbar. EndIf EndIf EndFuncThe necessary files are here: MyPSToolbar.zipDetailed instructions are on the project page.I hope you like it.
Negro Posted August 18, 2011 Posted August 18, 2011 Thanks.Working. but the program not move right or left ! You have to continue to develop [font="'Times New Roman"]Everything will be fine[/font]
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