AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Control Anchoring v4 for resizing windows
Goto page Previous  1, 2, 3 ... 10, 11, 12
 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
Solar



Joined: 03 May 2009
Posts: 345
Location: OH, USA

PostPosted: Tue May 26, 2009 3:53 pm    Post subject: Reply with quote

This works:
Code:
DetectHiddenWindows, On
newSize = w300 h200
Gui, +Resize +MinSize +LastFound
hGui := WinExist()
Gui, Add, ListView, w100 h50 vLV
Gui, Show, Hide ; set MinSize
WinWait, ahk_id %hGui%
Gui, Show, %newSize%
Return

GuiSize:
   Anchor("LV", "wh")
Return

GuiEscape:
GuiClose:
   ExitApp
Back to top
View user's profile Send private message
krisj209



Joined: 16 Nov 2007
Posts: 9
Location: California, USA

PostPosted: Fri Jun 19, 2009 8:04 am    Post subject: Titan, you are the man! Reply with quote

Thank you for this beautiful script!

You saved me so much time and frustration! Very Happy
_________________
Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened.

-Sir Winston Churchill
Back to top
View user's profile Send private message
jballi



Joined: 01 Oct 2005
Posts: 747
Location: Texas, USA

PostPosted: Sat Jul 25, 2009 2:01 am    Post subject: Reply with quote

I just came across the need to use the "Reset" feature of this function (reset by passing only the first parameter) but it doesn't appear to work with the latest version (v4.56). I recall (OK, it's been a while) that this worked in some previous versions of the function. Is is just me or did this option just go away?

To confirm that this option doesn't work anymore, just run the example (first post of this thread) with the latest version of the function (also available in the first post). When running the example script, press F10 to perform the Reset example.

Thank you for your consideration.
Back to top
View user's profile Send private message Send e-mail
tuna



Joined: 03 Oct 2007
Posts: 155
Location: UK

PostPosted: Sun Jan 31, 2010 5:44 am    Post subject: Reply with quote

Yeah, second that.
Back to top
View user's profile Send private message
TheGood



Joined: 30 Jul 2007
Posts: 580

PostPosted: Thu Aug 19, 2010 4:24 am    Post subject: Reply with quote

Here's a slightly modified version of Anchor with added support for AHK_L x64:

Code:
;Anchor by Titan
;http://www.autohotkey.com/forum/viewtopic.php?t=4348
Anchor(i, a = "", r = false) {
   static c, cs = 12, cx = 255, cl = 0, g, gs = 8, gl = 0, gpi, gw, gh, z = 0, k = 0xffff, ptr
   If z = 0
      VarSetCapacity(g, gs * 99, 0), VarSetCapacity(c, cs * cx, 0), ptr := A_PtrSize ? "Ptr" : "UInt", z := true
   If (!WinExist("ahk_id" . i)) {
      GuiControlGet, t, Hwnd, %i%
      If ErrorLevel = 0
         i := t
      Else ControlGet, i, Hwnd, , %i%
   }
   VarSetCapacity(gi, 68, 0), DllCall("GetWindowInfo", "UInt", gp := DllCall("GetParent", "UInt", i), ptr, &gi)
      , giw := NumGet(gi, 28, "Int") - NumGet(gi, 20, "Int"), gih := NumGet(gi, 32, "Int") - NumGet(gi, 24, "Int")
   If (gp != gpi) {
      gpi := gp
      Loop, %gl%
         If (NumGet(g, cb := gs * (A_Index - 1)) == gp, "UInt") {
            gw := NumGet(g, cb + 4, "Short"), gh := NumGet(g, cb + 6, "Short"), gf := 1
            Break
         }
      If (!gf)
         NumPut(gp, g, gl, "UInt"), NumPut(gw := giw, g, gl + 4, "Short"), NumPut(gh := gih, g, gl + 6, "Short"), gl += gs
   }
   ControlGetPos, dx, dy, dw, dh, , ahk_id %i%
   Loop, %cl%
      If (NumGet(c, cb := cs * (A_Index - 1), "UInt") == i) {
         If a =
         {
            cf = 1
            Break
         }
         giw -= gw, gih -= gh, as := 1, dx := NumGet(c, cb + 4, "Short"), dy := NumGet(c, cb + 6, "Short")
            , cw := dw, dw := NumGet(c, cb + 8, "Short"), ch := dh, dh := NumGet(c, cb + 10, "Short")
         Loop, Parse, a, xywh
            If A_Index > 1
               av := SubStr(a, as, 1), as += 1 + StrLen(A_LoopField)
                  , d%av% += (InStr("yh", av) ? gih : giw) * (A_LoopField + 0 ? A_LoopField : 1)
         DllCall("SetWindowPos", "UInt", i, "UInt", 0, "Int", dx, "Int", dy
            , "Int", InStr(a, "w") ? dw : cw, "Int", InStr(a, "h") ? dh : ch, "Int", 4)
         If r != 0
            DllCall("RedrawWindow", "UInt", i, "UInt", 0, "UInt", 0, "UInt", 0x0101) ; RDW_UPDATENOW | RDW_INVALIDATE
         Return
      }
   If cf != 1
      cb := cl, cl += cs
   bx := NumGet(gi, 48, "UInt"), by := NumGet(gi, 16, "Int") - NumGet(gi, 8, "Int") - gih - NumGet(gi, 52, "UInt")
   If cf = 1
      dw -= giw - gw, dh -= gih - gh
   NumPut(i, c, cb, "UInt"), NumPut(dx - bx, c, cb + 4, "Short"), NumPut(dy - by, c, cb + 6, "Short")
      , NumPut(dw, c, cb + 8, "Short"), NumPut(dh, c, cb + 10, "Short")
   Return, true
}
Back to top
View user's profile Send private message Visit poster's website
Guest






PostPosted: Wed Jul 13, 2011 10:32 pm    Post subject: Reply with quote

Thanks for coding this!. Surprised
Bumping to help others,
Back to top
BGM



Joined: 12 Jan 2011
Posts: 84

PostPosted: Fri Oct 14, 2011 4:56 pm    Post subject: Reply with quote

Hello! I am having a few troubles with Anchor and 64bit AutoHotkey_L. I couldn't find this post in the search, so I posted anew - here:

http://www.autohotkey.com/forum/viewtopic.php?p=482071#482071
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3 ... 10, 11, 12
Page 12 of 12

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group