toonboon Posted November 21, 2008 Posted November 21, 2008 can I create an immovable GUI? I found the answer nowhere in the helpfile, so I thought posting it here might solve it. [right]~What can I say, I'm a Simplistic person[/right]
youknowwho4eva Posted November 21, 2008 Posted November 21, 2008 (edited) while 1 $array = wingetpos("unmovable gui") If $array[0] <> $original width or $array[1] <> $originalheight then guisetcoord($array[2],$array[3],$originalwidth,$originalheight) wend Edit: forgot some stuff Edited November 21, 2008 by youknowwho4eva Giggity
toonboon Posted November 21, 2008 Author Posted November 21, 2008 I figured that out just 5 seconds after you posted it I was wondering if there was something like GuiSetState(@SW_STICK) (or something like that...) [right]~What can I say, I'm a Simplistic person[/right]
Tomb Posted November 21, 2008 Posted November 21, 2008 i didnt see any GUI control styles for unmovable, but what about this? #Include <GUIConstants.au3> #Include <WindowsConstants.au3> $GUI = GUICreate("Test GUI", 400, 400, -1, -1) GuiSetState(@SW_SHOW) Opt("GUIOnEventMode",1) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $StartWinPos = WinGetPos("Test GUI", "") While 1 sleep(10) $WinPos = WinGetPos("Test GUI", "") If $StartWinPos[0] <> $WinPos[0] or $StartWinPos[1] <> $WinPos[1] Then WinMove("Test GUI", "", $StartWinPos[0], $StartWinPos[1]) EndIf WEnd Func _Exit() Exit EndFunc
toonboon Posted November 21, 2008 Author Posted November 21, 2008 Ok thanks that code workt even better than perfectly =) [right]~What can I say, I'm a Simplistic person[/right]
ResNullius Posted November 21, 2008 Posted November 21, 2008 http://www.autoitscript.com/forum/index.ph...st&p=515108
wraithdu Posted November 21, 2008 Posted November 21, 2008 Another option to give you more control over what happens to the window - #Include <GUIConstants.au3> #Include <WindowsConstants.au3> #include <Constants.au3> $GUI = GUICreate("Test GUI", 400, 400, -1, -1) GuiSetState(@SW_SHOW) Opt("GUIOnEventMode",1) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $pos = WinGetPos($GUI) GUIRegisterMsg($WM_WINDOWPOSCHANGING, "MY_MSG") While 1 Sleep(1000) WEnd Func MY_MSG($hwnd, $msg, $wparam, $lparam) $tagWINDOWPOS = "hwnd hwnd;hwnd hwndInsertAfter;int x;int y;int cx;int cy;uint Flags" $wpos = DllStructCreate($tagWINDOWPOS, $lparam) DllStructSetData($wpos, "Flags", BitOR($SWP_NOMOVE, $SWP_NOSIZE)) Return 0 EndFunc Func _Exit() Exit EndFunc
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