Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

[AHK 1.1+] AnimateWindow wrapper


  • Please log in to reply
18 replies to this topic
nimda
  • Members
  • 4368 posts
  • Last active: Aug 09 2015 02:36 AM
  • Joined: 26 Dec 2010
The function can be done like this:
AnimateWindow(HWND, Options, t=200){
   o := 0, op := {Activate : 0x00020000, Fade : 0x00080000
                , Center   : 0x00000010, Hide : 0x00010000
                , LR       : 0x00000001, RL   : 0x00000002
                , Slide    : 0x00040000, TB   : 0x00000004
                , BT       : 0x00000008}
   , List = "Activate|Blend|Center|Hide|LR|RL|Slide|TB|BT"
   Loop Parse, List,|
      If InStr(Options, A_LoopField, false)
         o |= op[A_LoopField]
   return DllCall("AnimateWindow", "UPtr", HWND, "Int", t, "UInt", o)
}
to improve readability.

cdashner
  • Members
  • 20 posts
  • Last active: Sep 22 2011 09:37 PM
  • Joined: 08 Mar 2011
This function is awesome and works great for windows that I want to build and then kill. I have one application that I hide the window and recall it with a key stroke. When I try to use this function with that it will not work. From what I can tell when I hide the window it loses the Window ID and I cannot open it with the animation. What might I be doing wrong?

nimda
  • Members
  • 4368 posts
  • Last active: Aug 09 2015 02:36 AM
  • Joined: 26 Dec 2010
Post your script. Notice the example in the OP which works, showing, hiding, and showing again.

cdashner
  • Members
  • 20 posts
  • Last active: Sep 22 2011 09:37 PM
  • Joined: 08 Mar 2011
I actually found the issue I was having. The problem was I did not have the detecthiddenwindows function turned on so that I could locate the window ID. Once I turned that on I was good to go. Thank you for the response on this.