iCode Posted November 28, 2013 Posted November 28, 2013 (edited) played with this for a while and haven't figured it out with windows 7, and i don;t know what other flavors, you can't move a window past the top of the display - i think aero-snap is pushing it back down i've seen several threads on stackexchange about this, many of which say you can get around the problem with a combination of gui styles, however i could not find a combo that worked what i don't understand in my example, is why the second (Y) element in the WinGetPos() array is returning 0 instead of the actual position when the mouse button is released (watch the end of the longer string in the console) i'm trying to work around aero-snap without disabling it (not an option), but you will see from my example it isn't working try moving this window past the top edge of your display... expandcollapse popup#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <WINAPI.au3> Global Const $frameSz = 128 Global Const $formSz = 500 Global $aPos Global $Form1 = GUICreate("Form1", $formSz, $formSz, -1, -1, $WS_POPUP, $WS_EX_LAYERED) GUISetBkColor(0xFFFFFF) Global $Label1 = GUICtrlCreateLabel("", 0, 0, $formSz, $formSz / 2 - $frameSz / 2, -1, $GUI_WS_EX_PARENTDRAG) ; top GUICtrlSetBkColor(-1, 0x000000) Global $Label2 = GUICtrlCreateLabel("", $formSz / 2 + $frameSz / 2, $formSz / 2 - $frameSz / 2, $formSz / 2 - $frameSz / 2, $frameSz, -1, $GUI_WS_EX_PARENTDRAG) ; right GUICtrlSetBkColor(-1, 0x000000) Global $Label3 = GUICtrlCreateLabel("", 0, $formSz / 2 + $frameSz / 2, $formSz, $formSz / 2 + $frameSz / 2, -1, $GUI_WS_EX_PARENTDRAG) ; bottom GUICtrlSetBkColor(-1, 0x000000) Global $Label4 = GUICtrlCreateLabel("", 0, $formSz / 2 - $frameSz / 2, $formSz / 2 - $frameSz / 2, $frameSz, -1, $GUI_WS_EX_PARENTDRAG) ; left GUICtrlSetBkColor(-1, 0x000000) GUISetState(@SW_SHOW) _WinAPI_SetLayeredWindowAttributes($Form1, 0xFFFFFF, 150) GUIRegisterMsg($WM_MOVE, "my_func1") GUIRegisterMsg($WM_EXITSIZEMOVE, "my_func2") Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Func my_func1() $aPos = WinGetPos($Form1) ConsoleWrite($aPos[1] & ".") EndFunc Func my_func2() ConsoleWrite(@LF & $aPos[1] & @LF) WinMove($Form1, "", $aPos[0], $aPos[1], $aPos[2], $aPos[3]) EndFunc update: these changes get what i want, but i'd like to hear from anyone that might have better method ... expandcollapse popup#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <WINAPI.au3> Global Const $frameSz = 128 Global Const $formSz = 500 Global $aPos Global $iLastPos Global $Form1 = GUICreate("Form1", $formSz, $formSz, -1, -1, $WS_POPUP, $WS_EX_LAYERED) GUISetBkColor(0xFFFFFF) Global $Label1 = GUICtrlCreateLabel("", 0, 0, $formSz, $formSz / 2 - $frameSz / 2, -1, $GUI_WS_EX_PARENTDRAG) ; top GUICtrlSetBkColor(-1, 0x000000) Global $Label2 = GUICtrlCreateLabel("", $formSz / 2 + $frameSz / 2, $formSz / 2 - $frameSz / 2, $formSz / 2 - $frameSz / 2, $frameSz, -1, $GUI_WS_EX_PARENTDRAG) ; right GUICtrlSetBkColor(-1, 0x000000) Global $Label3 = GUICtrlCreateLabel("", 0, $formSz / 2 + $frameSz / 2, $formSz, $formSz / 2 + $frameSz / 2, -1, $GUI_WS_EX_PARENTDRAG) ; bottom GUICtrlSetBkColor(-1, 0x000000) Global $Label4 = GUICtrlCreateLabel("", 0, $formSz / 2 - $frameSz / 2, $formSz / 2 - $frameSz / 2, $frameSz, -1, $GUI_WS_EX_PARENTDRAG) ; left GUICtrlSetBkColor(-1, 0x000000) GUISetState(@SW_SHOW) _WinAPI_SetLayeredWindowAttributes($Form1, 0xFFFFFF, 150) GUIRegisterMsg($WM_MOVE, "my_func1") GUIRegisterMsg($WM_EXITSIZEMOVE, "my_func2") Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Func my_func1() $aPos = WinGetPos($Form1) If $aPos[1] <> 0 Then $iLastPos = $aPos[1] ConsoleWrite($aPos[1] & ",") EndFunc Func my_func2() ConsoleWrite(@LF & $aPos[1] & @LF) WinMove($Form1, "", $aPos[0], $iLastPos, $aPos[2], $aPos[3]) EndFunc Edited November 28, 2013 by iCode FUNCTIONS: WinDock (dock window to screen edge) | EditCtrl_ToggleLineWrap (line/word wrap for AU3 edit control) | SendEX (yet another alternative to Send( ) ) | Spell Checker (Hunspell wrapper) | SentenceCase (capitalize first letter of sentences) CODE SNIPPITS: Dynamic tab width (set tab control width according to window width)
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