Jump to content

AnimateWindow DLL Call


zcoacoaz
 Share

Recommended Posts

look at what i came across on msdn :) its pretty cool

$hwnd = GUICreate ( "Blend test", 300, 300 )
DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00080000 )
GUISetState ( )
DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00090000 )
DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040001 )
DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1, "long", 0x00090000 )
DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040002 )
DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1, "long", 0x00090000 )
DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040004 )
DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1, "long", 0x00090000 )
DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040008 )
DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1, "long", 0x00090000 )
DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040005 )
DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1, "long", 0x00090000 )
DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040006 )
DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1, "long", 0x00090000 )
DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040009 )
DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1, "long", 0x00090000 )
DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x0004000a )
DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1, "long", 0x00090000 )
DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040010 )
DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050010 )

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Link to comment
Share on other sites

eww, no fair i was going to do that... :D before i saw that dllcall though, i made this as an alternave for the fading window..

Func _WinFade($WinTitle, $Style)
    Local $WinTitle, $Style, $in, $out
    If $Style = 1 Then
        For $in = 0 to 255 step +5; step +5 may be too much or too little? cant tell, my computer doesnt like transparency..
            WinSetTrans($WinTitle, "", $in)
        Next
    EndIf
    If $Style = 0 Then
        For $out = 255 to 0 step +5
            WiNSetTrans($WinTitle, "", $out)
        Next
    EndIf
EndFunc

a little dirty, but oh well :D

good work eh :huh:

EDIT: Question... Now I remeber why I couldn't get it to work, I didn't have any values, I was trying to use the words, like "AW_BLEND". So I'm wondering, where did you get those values for it? Thanks! :)

Edited by layer
FootbaG
Link to comment
Share on other sites

@Xenogis, yah cool.

@layer, They're in winuser.h

#define AW_HOR_POSITIVE            0x00000001

#define AW_HOR_NEGATIVE            0x00000002

#define AW_VER_POSITIVE            0x00000004

#define AW_VER_NEGATIVE            0x00000008

#define AW_CENTER                  0x00000010

#define AW_HIDE                    0x00010000

#define AW_ACTIVATE                0x00020000

#define AW_SLIDE                    0x00040000

#define AW_BLEND                    0x00080000

601DisengageEnd Program

Link to comment
Share on other sites

Here's another way for those of you who don't want to use DllCall()

$hwnd = GUICreate ( "Blend test", 300, 300 )
WinSetTrans($hwnd, "", 0)
GUISetState ( )

For $I = 0 To 255 Step + 5
   WinSetTrans($hwnd, "", $I)
   Sleep(10)
Next; fade-in

Sleep(1000)

For $I = 255 To 0 Step - 5
   WinSetTrans($hwnd, "", $I)
   Sleep(10)
Next; fade-out

Sleep(1000)
WinSetTrans($hwnd, "", 255)

For $I = 0 To 300 Step + 5
  WinMove ( "Blend test", "", 250, 150, $i,300)
  Sleep(10)
Next; slide-in from left

Sleep(1000)

For $I = 300 To 0 Step - 5
  WinMove ( "Blend test", "", 250, 150, $i,300)
  Sleep(10)
Next; slide-out from left

Sleep(1000)

$p = 0
For $I = 550 To 250 Step - 5
  WinMove ( "Blend test", "", $I, 150, $p, 300)
  $p = $p + 5
  Sleep(10)
Next; slide-in from right

Sleep(1000)

$p = 300
For $I = 250 To 550 Step + 5
  WinMove ( "Blend test", "", $I, 150, $p, 300)
  $p = $p - 5
  Sleep(10)
Next; slide-out from left

Sleep(1000)

For $I = 0 To 300 Step + 5
  WinMove ( "Blend test", "", 250, 150, 300, $I)
  Sleep(10)
Next; slide-in from top

Sleep(1000)

For $I = 300 To 0 Step - 5
  WinMove ( "Blend test", "", 250, 150, 300, $I)
  Sleep(10)
Next; slide-out from top

Sleep(1000)

$p = 0
For $I = 450 To 150 Step - 5
  WinMove ( "Blend test", "", 250, $I, 300, $p)
  $p = $p + 5
  Sleep(10)
Next; slide-in from bottom

Sleep(1000)

$p = 300
For $I = 150 To 450 Step + 5
  WinMove ( "Blend test", "", 250, $I, 300, $p)
  $p = $p - 5
  Sleep(10)
Next; slide-out from bottom

Sleep(1000)

For $I = 0 To 300 Step + 5
  WinMove ( "Blend test", "", 250, 150, $i,$i)
  Sleep(10)
Next; diag slide-in from top-left

Sleep(1000)

For $I = 300 To 0 Step - 5
  WinMove ( "Blend test", "", 250, 150, $i,$i)
  Sleep(10)
Next; diag slide-out from top-left

Sleep(1000)

$p = 0
For $I = 550 To 250 Step - 5
  WinMove ( "Blend test", "", $I, 150, $p, $p)
  $p = $p + 5
  Sleep(10)
Next; diag slide-in from top-right

Sleep(1000)

$p = 300
For $I = 250 To 550 Step + 5
  WinMove ( "Blend test", "", $I, 150, $p, $p)
  $p = $p - 5
  Sleep(10)
Next; diag slide-out from top-right

Sleep(1000)

$p = 0
For $I = 450 To 150 Step - 5
  WinMove ( "Blend test", "", 250, $I, $p, $p)
  $p = $p + 5
  Sleep(10)
Next; diag slide-in from bottom-left

Sleep(1000)

$p = 300
For $I = 150 To 450 Step + 5
  WinMove ( "Blend test", "", 250, $I, $p, $p)
  $p = $p - 5
  Sleep(10)
Next; diag slide-out from bottom-left

Sleep(1000)

$p = 0
For $I = 550 To 250 Step - 5
  $z = $i - 100
  WinMove ( "Blend test", "", $I, $z, $p, $p)
  $p = $p + 5
  Sleep(10)
Next; diag slide-in from bottom-right

Sleep(1000)

$p = 300
For $I = 250 To 550 Step + 5
  $z = $i - 100
  WinMove ( "Blend test", "", $I, $z, $p, $p)
  $p = $p - 5
  Sleep(10)
Next; diag slide-out from bottom-right

Sleep(1000)

$Width = @DesktopWidth / 2

For $I = 0 To 300 Step + 5
  $Left = @DesktopWidth / 2 - $I / 2
  $Top = $Left - 100
  WinMove ( "Blend test", "", $Left, $Top, $I, $I)
  Sleep(10)
Next; explode

Sleep(1000)

For $I = 300 To 0 Step - 5
  $Left = $Width - $I / 2
  $Top = $Left - 100
  WinMove ( "Blend test", "", $Left, $Top, $I,$I)
  Sleep(10)
Next; implode

Sleep(1000)

For the explode and implode effects... The syntax is correct and it should be a width/height of 300, but for some strange reason its not. It was just a little too small and thats why I added $I * 1.02 etc to get the window size correct :).

Edit: I just realised that all the windows are slightly shorter then there supposed to be... weird. I have now removed the $I * blah from the above code.

Edited by Burrup

qq

Link to comment
Share on other sites

$hwnd = GUICreate ( "Slidin' Window", 300, 300 )
DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040004 )
DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050004 )
DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040008 )
DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050008 )
DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040001 )
DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050001 )
DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040002 )
DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050002 )

this one keeps sliding until it dissapears again

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Link to comment
Share on other sites

  • 1 month later...

$hwnd = GUICreate ( "Blend test", 300, 300 )

DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040002 )
Sleep(1500)
DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050001 )

GUISetState ( )
Sleep(1000)

Some of them require you to use DllCall() before GUISetState().

qq

Link to comment
Share on other sites

  • 4 years later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...