 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Solar
Joined: 03 May 2009 Posts: 345 Location: OH, USA
|
Posted: Tue May 26, 2009 3:53 pm Post subject: |
|
|
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 |
|
 |
krisj209
Joined: 16 Nov 2007 Posts: 9 Location: California, USA
|
Posted: Fri Jun 19, 2009 8:04 am Post subject: Titan, you are the man! |
|
|
Thank you for this beautiful script!
You saved me so much time and frustration!  _________________ 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 |
|
 |
jballi
Joined: 01 Oct 2005 Posts: 747 Location: Texas, USA
|
Posted: Sat Jul 25, 2009 2:01 am Post subject: |
|
|
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 |
|
 |
tuna
Joined: 03 Oct 2007 Posts: 155 Location: UK
|
Posted: Sun Jan 31, 2010 5:44 am Post subject: |
|
|
| Yeah, second that. |
|
| Back to top |
|
 |
TheGood
Joined: 30 Jul 2007 Posts: 580
|
Posted: Thu Aug 19, 2010 4:24 am Post subject: |
|
|
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 |
|
 |
Guest
|
Posted: Wed Jul 13, 2011 10:32 pm Post subject: |
|
|
Thanks for coding this!.
Bumping to help others, |
|
| Back to top |
|
 |
BGM
Joined: 12 Jan 2011 Posts: 84
|
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|