AutoHotkey Community

It is currently May 27th, 2012, 4:12 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 172 posts ]  Go to page Previous  1 ... 8, 9, 10, 11, 12
Author Message
 Post subject:
PostPosted: May 26th, 2009, 4:53 pm 
Offline

Joined: May 3rd, 2009, 7:16 pm
Posts: 345
Location: OH, USA
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Titan, you are the man!
PostPosted: June 19th, 2009, 9:04 am 
Offline

Joined: November 16th, 2007, 8:31 am
Posts: 10
Location: California, USA
Thank you for this beautiful script!

You saved me so much time and frustration! :D

_________________
Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened.

-Sir Winston Churchill


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 25th, 2009, 3:01 am 
Offline

Joined: October 1st, 2005, 9:55 pm
Posts: 775
Location: Texas, USA
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 31st, 2010, 6:44 am 
Offline

Joined: October 3rd, 2007, 9:32 pm
Posts: 157
Location: UK
Yeah, second that.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 19th, 2010, 5:24 am 
Offline

Joined: July 30th, 2007, 11:32 pm
Posts: 581
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
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 13th, 2011, 11:32 pm 
Thanks for coding this!. :o
Bumping to help others,


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 14th, 2011, 5:56 pm 
Offline

Joined: January 12th, 2011, 4:04 pm
Posts: 93
Location: Kansas City, USA
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/viewtop ... 071#482071


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 172 posts ]  Go to page Previous  1 ... 8, 9, 10, 11, 12

All times are UTC [ DST ]


Who is online

Users browsing this forum: Stigg and 15 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group