Sign in to follow this  
Followers 0
h711

Question about using "AnimateWindow" API

6 posts in this topic

Hi guys, while I am playing with XSkin mod, I found it use AnimateWindow API to add special effects for displaying windows.

DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $SKBox_[$XS_TMB], "int", 500, "long", 0x00040008);slide-in from bottom

So I checked MSDN for the AnimateWindow function.

BOOL AnimateWindow(       
HWND hwnd,
    DWORD dwTime,
    DWORD dwFlags
);

My question is, how to convert "DWORD dwFlags" to ""long", 0x00040008"? I want to try some other effects but have no idea how to convert words like "AW_SLIDE" to a hex number.

Thanks for the help!

Share this post


Link to post
Share on other sites



Hi guys, while I am playing with XSkin mod, I found it use AnimateWindow API to add special effects for displaying windows.

DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $SKBox_[$XS_TMB], "int", 500, "long", 0x00040008);slide-in from bottom

So I checked MSDN for the AnimateWindow function.

BOOL AnimateWindow(       
HWND hwnd,
    DWORD dwTime,
    DWORD dwFlags
);

My question is, how to convert "DWORD dwFlags" to ""long", 0x00040008"? I want to try some other effects but have no idea how to convert words like "AW_SLIDE" to a hex number.

Thanks for the help!

I hope this example will help.

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$gui = GUICreate("Animated by API", 353, 256, 303, 219)
GUISetIcon("D:\007.ico")
$ListBox1 = GUICtrlCreateList("", 8, 8, 137, 201)
GUICtrlSetData(-1, "Item1|Item2|Item3|Item4|Item5")
$Button1 = GUICtrlCreateButton(">", 156, 15, 30, 25, 0)
$Button2 = GUICtrlCreateButton(">>", 156, 48, 31, 25, 0)
$Button3 = GUICtrlCreateButton("<", 157, 81, 31, 25, 0)
GUICtrlSetState(-1, $GUI_DISABLE)
$Button4 = GUICtrlCreateButton("<<", 157, 114, 32, 25, 0)
$ListBox2 = GUICtrlCreateList("", 200, 8, 137, 201)
$Button5 = GUICtrlCreateButton("&OK", 104, 225, 75, 25, 0)
$Button6 = GUICtrlCreateButton("&Cancel", 184, 225, 75, 25, 0)
$Button7 = GUICtrlCreateButton("&Help", 264, 225, 75, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###



Const $AW_SHOW = 0x00020000
 ; AW_SLIDE Uses slide animation.
 Const $AW_SLIDE = 0x00040000
 ; ROLL/SLIDE need to be used with one of the following:
Const $AW_RIGHT = 0x00000001
Const $AW_LEFT = 0x0000002
Const $AW_DOWN = 0x0000004
Const $AW_EUP = 0x0000008
 ; Add RIGHT/LEFT with UP/DOWN for diagonal effects.
 ; ::
 ; AW_BLEND Uses a fade effect.Can be used only if hwnd is a top-level window.
 ; Win 2000 or higher
Const $AW_BLEND = 0x00080000


 ; AW_CENTER Makes the window appear to collapse inward if AW_HIDE is used or expand
 ; outward if the AW_HIDE is not used.
Const $AW_CENTER = 0x00000010
Const $AW_HIDE = 0x00010000
 ;time animation takes, in milliseconds.
Const $AWTime = 500



AnimateClose($gui,BitOr($AW_SLIDE,$AW_LEFT),1200)
Sleep(500);
AnimateOpen($gui,$AW_CENTER,1200)
Sleep(500)
AnimateClose($gui,$AW_EUP,1200)
Sleep(500);
AnimateOpen($gui,$AW_DOWN,1200)
Sleep(500)
AnimateClose($gui,BitOR($AW_LEFT,$AW_EUP),1200)
Sleep(500);
AnimateOpen($gui,BitOR($AW_RIGHT,$AW_EUP),1200)
Sleep(500)

;faded
AnimateClose($gui,$AW_BLEND,1200)
Sleep(500);
AnimateOpen($gui,$AW_BLEND,2000)
Sleep(500)
Sleep(500)



Func AnimateOpen($hW,$AOStyle,$ttime)
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hw, "int", $ttime, "long", $AOStyle);slide out to left
    
EndFunc

Func AnimateClose($hW,$ACStyle,$ttime = 500);$AWTime)
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hw, "int", $ttime, "long", BitOR($AW_HIDE,$ACStyle))
EndFunc

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Thanks, I got this to work now.

Where did you get those hex number in the first place?

Share this post


Link to post
Share on other sites

Thanks, I got this to work now.

Where did you get those hex number in the first place?

I don't know where I got them. I wrote that example some time ago (assuming I remember correctly and I did write it). I think Microsoft should give the values of constants where they explain the function.

I usually find those sort of values by searching AutoIt forums, and googling, and searching the AutoIt includes.

Include files used in C, ie *.h, are a usefule source of constants.

I have recently beend looking at a C compiler and I see that in an include file called winuser.h there is this

#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

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Thanks man.

Share this post


Link to post
Share on other sites

Thanks man.

That's ok.

I found this site which seems to have just about every Windows constan in zip files for downloading.http://www.carabez.com/downloads.html"&lt;/a&gt;">

See the bottom of the page under "Download Others".http://www.carabez.com/downloads.html

The files in

Windows API Constants and Structures for Masm32 ver 1.4c

includes later constants for Vista as well as other constants which are in

Windows API Constants and Structures for Masm32 ver 1.27d

The constants.zip gives an HTML file with constants in alphabetical order which makes it quick to find something, but there are a few constants missing.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0