News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Dialog Animations - AnimateWindow API and RadioButton Usage

Started by bluedevil, November 04, 2012, 09:42:29 AM

Previous topic - Next topic

bluedevil

AnimateWindow function; enables you to produce special effects when showing or hiding windows. There are four types of animation: roll, slide, collapse or expand, and alpha-blended fade.

Syntax:
AnimateWindow,hWnd,dwTime,dwFlags
Example:
invoke AnimateWindow,hWin,600,AW_HIDE or AW_SLIDE or AW_HOR_POSITIVE

Parameters:
hwnd [in]; Type: HWND
A handle to the window to animate. The calling thread must own this window.
dwTime [in]; Type: DWORD
The time it takes to play the animation, in milliseconds. Typically, an animation takes 200 milliseconds to play.
dwFlags [in]; Type: DWORD
The type of animation. This parameter can be one or more of the following values. Note that, by default, these flags take effect when showing a window. To take effect when hiding a window, use AW_HIDE and a logical OR operator with the appropriate flags.

Value               Meaning

AW_ACTIVATE         Activates the window. Do not use this value with AW_HIDE.
0x00020000

AW_BLEND            Uses a fade effect. This flag can be used only if hwnd is a top-level window.
0x00080000

AW_CENTER           Makes the window appear to collapse inward if AW_HIDE is used or expand outward
0x00000010          if the AW_HIDE is not used. The various direction flags have no effect.

AW_HIDE             Hides the window. By default, the window is shown.
0x00010000

AW_HOR_POSITIVE     Animates the window from left to right. This flag can be used with roll
0x00000001          or slide animation. It is ignored when used with AW_CENTER or AW_BLEND.

AW_HOR_NEGATIVE     Animates the window from right to left. This flag can be used with roll or
0x00000002          slide animation. It is ignored when used with AW_CENTER or AW_BLEND.

AW_SLIDE            Uses slide animation. By default, roll animation is used.
0x00040000          This flag is ignored when used with AW_CENTER.

AW_VER_POSITIVE     Animates the window from top to bottom. This flag can be used with roll or
0x00000004          slide animation. It is ignored when used with AW_CENTER or AW_BLEND.

AW_VER_NEGATIVE     Animates the window from bottom to top. This flag can be used with roll or slide animation.
0x00000008          It is ignored when used with AW_CENTER or AW_BLEND.


About RadioButtons:
In the sample code there are 2 groups of RadioButtons. One is for opening and the other is for closing.
1. Make the ID's of radiobuttons in sequence. It is important while making groups.
2. Make Tab content  in sequence(right click to the dialog on RadASM)
3. While editing the dialog on RadASM there is a properties section on the right. Select the head of the radiobuttons group and make its "Group" propertie "True". (Examine the sample codes)

I have prepared a sample code for this function. I have attached it here.
If there are mistakes or bugs, anybody can involve and fix. I will be happy if he/she informs me.
Sorry for bad english!
Regards
..Dreams make the future
But the past never lies..
BlueDeviL // SCT
My Code Site:
BlueDeviL Github

ragdog

Many api calls use this


invoke IsDlgButtonChecked,hWin,1014 ;Slide from Right
cmp eax,0
jz _Sonraki
    mov ebx,AW_HIDE or AW_SLIDE or AW_HOR_NEGATIVE
jmp _Son
_Sonraki:
invoke IsDlgButtonChecked,hWin,1015 ;Slide from Left
cmp eax,0
jz _Sonraki0
mov ebx,AW_HIDE or AW_SLIDE or AW_HOR_POSITIVE
jmp _Son
_Sonraki0:
invoke IsDlgButtonChecked,hWin,1016 ;Diagonal Right to Left
cmp eax,0
jz _Sonraki1
mov ebx,AW_HIDE or AW_HOR_NEGATIVE or AW_VER_POSITIVE
jmp _Son
_Sonraki1:
invoke IsDlgButtonChecked,hWin,1017 ;Diagonal Left to Right
cmp eax,0
jz _Sonraki2
mov ebx,AW_HIDE or AW_HOR_POSITIVE or AW_VER_POSITIVE
jmp _Son
_Sonraki2:
invoke IsDlgButtonChecked,hWin,1018 ;(Blending ya da fading)
cmp eax,0
jz _Sonraki3
mov ebx,AW_HIDE or AW_BLEND
jmp _Son
_Sonraki3:
invoke IsDlgButtonChecked,hWin,1019 ;Collapse to the Center
cmp eax,0
jz _Sonraki4
mov ebx,AW_HIDE or AW_CENTER
jmp _Son
_Sonraki4:
invoke IsDlgButtonChecked,hWin,1020 ;Botton to Top
cmp eax,0
jz _Sonraki5
mov ebx,AW_HIDE or AW_VER_NEGATIVE
jmp _Son
_Sonraki5:
invoke IsDlgButtonChecked,hWin,1021 ;Top to Bottom
cmp eax,0
jz _Sonraki6
mov ebx,AW_HIDE or AW_VER_POSITIVE
jmp _Son
_Sonraki6:
invoke IsDlgButtonChecked,hWin,1022 ;Right to Left
cmp eax,0
jz _Sonraki7
mov ebx,AW_HIDE or AW_HOR_NEGATIVE
jmp _Son
_Sonraki7:
mov ebx,AW_HIDE or AW_HOR_POSITIVE;Left to Right

_Son:
invoke AnimateWindow,hWin,600,ebx
invoke EndDialog,hWin,0 ;Close the windows
ret
.endif

hutch--

blue_devil,

The demo works fine on my XP SP3. One thing, the main dialog does not re-appear after the animated window closes, you have to go look for it.

bluedevil

Quote from: hutch-- on November 04, 2012, 11:19:01 PM
blue_devil,

The demo works fine on my XP SP3. One thing, the main dialog does not re-appear after the animated window closes, you have to go look for it.
I have just forgot to add that line to restore main dialog:
invoke ShowWindow,hMain,SW_RESTORE; to restore the main dialog :t
..Dreams make the future
But the past never lies..
BlueDeviL // SCT
My Code Site:
BlueDeviL Github

bluedevil

@ragdog, thanks for your optimization :t
i have edited the sources according to your optmization
..Dreams make the future
But the past never lies..
BlueDeviL // SCT
My Code Site:
BlueDeviL Github

Gunther

Hi blue_devil,

your demo works well under Windows 7 (64 bit), SP 1. Good job.  :t

Gunther 
You have to know the facts before you can distort them.

bluedevil

Quote from: Gunther on November 05, 2012, 03:46:21 AM
Hi blue_devil,

your demo works well under Windows 7 (64 bit), SP 1. Good job.  :t

Gunther
I didnt tested on 64bit thanks for trying :bgrin:
..Dreams make the future
But the past never lies..
BlueDeviL // SCT
My Code Site:
BlueDeviL Github

FORTRANS

Hi,

   Tested on Windows 2000 with a P-III.  Worked well until
I tried the slide option.

   'The instruction at "0x77e28ce8" referenceced memory at
"0x006002c". The memory could not be "read".  Click on
okay to terminate the program.'

Regards,

Steve N.

Gunther

Hi blue_devil,

Quote from: blue_devil on November 05, 2012, 04:32:28 AM
I didnt tested on 64bit thanks for trying :bgrin:

your wish was my command. Your application is well written and works fine.

Gunther
You have to know the facts before you can distort them.

Bill Cravener

Good example blue_devil! :icon14:

Nice to see some folks posting examples here on the Masm32 board (that means you too Gunther). Back in the day many of us posted examples for others to enjoy and learn from but it seems these days people like to take yet give little back in return. In fact I see some members here who never give anything back to the community other then lip service about things not even related to the subject of assembly.

I have no problem with opinions on other subjects, I myself do it often, but at the least give something back to the Masm32 community as you blue_devil have done here. Examples help to inspire those who really wish to learn Windows assembly programming. I'd like to see more creativity such as yours here on the board. I remember back in the old days there were examples posted by members nearly everyday. I miss those days. ;)

Gunther

Bill,

Quote from: Bill Cravener on November 06, 2012, 03:40:44 AM
Nice to see some folks posting examples here on the Masm32 board (that means you too Gunther). Back in the day many of us posted examples for others to enjoy and learn from but it seems these days people like to take yet give little back in return. In fact I see some members here who never give anything back to the community other then lip service about things not even related to the subject of assembly.

I have no problem with opinions on other subjects, I myself do it often, but at the least give something back to the Masm32 community as you blue_devil have done here. Examples help to inspire those who really wish to learn Windows assembly programming. I'd like to see more creativity such as yours here on the board. I remember back in the old days there were examples posted by members nearly everyday. I miss those days. ;)

right. You made an important point, Bill. I miss those days, too. I can remember the old Compuserve forum days (MASM, TASM, PowerBASIC) in the 80s. We had a lot of interesting discussions, uploads and the share of programming ideas. All things considered: it was a good time and I've learned a lot.

Gunther 
You have to know the facts before you can distort them.

Bill Cravener

Quote from: Gunther on November 06, 2012, 04:38:06 AM
I can remember the old Compuserve forum days (MASM, TASM, PowerBASIC) in the 80s. We had a lot of interesting discussions, uploads and the share of programming ideas. All things considered: it was a good time and I've learned a lot.

Gunther

Hi Gunther,

Yes I was there back in the 80's on CompuServe. I remember it well and I was once even commented on about one of my old DOS utilities back when they had their monthly magazine. Those were really fun times and we all loved these computing machines that we now take for granted. Funny thing back then, it required me to dialup long distance to connect to CompuServe and my monthly phones bills were so high that I could have taken that money and made the monthly payment on a Chevy Corvette. But at the time being a CompuServe member back then was way more interesting then owning a hot car. :biggrin:

bluedevil

@FORTRANS; great thanks for testing on Win2000. I couldnt understand the error, because on msdn, function requires at least Win 2000?

@Bill Cravener; so many thanks for your comment =) I wish i could post more! My two year old son doesnt allow me when i am back at home in the evenings.

We have a forum (it is Turkish and includes assembly subforum), and we have the same problem. People doesnt share any sources or hints or anything. Just registering and vanishing :eusa_snooty:. There was an era that people posted and shared lots of thing; you lived that time, i cant miss but i want to live that time too. :icon_confused:
..Dreams make the future
But the past never lies..
BlueDeviL // SCT
My Code Site:
BlueDeviL Github

Gunther

Bill,

Quote from: Bill Cravener on November 06, 2012, 10:06:25 PM
Yes I was there back in the 80's on CompuServe. I remember it well and I was once even commented on about one of my old DOS utilities back when they had their monthly magazine. Those were really fun times and we all loved these computing machines that we now take for granted. Funny thing back then, it required me to dialup long distance to connect to CompuServe and my monthly phones bills were so high that I could have taken that money and made the monthly payment on a Chevy Corvette. But at the time being a CompuServe member back then was way more interesting then owning a hot car. :biggrin:

Those were very interesting times, too. To be honest, I miss some good guys from those days.

Gunther
You have to know the facts before you can distort them.

Bill Cravener

Yep, there was a good many of us geeks back then who loved assembly. CompuServe really had an important part in the development and progress of the personal PC back then. What I really miss about those days was being in my early 40's and banging as many women in their 20's and 30's as I could find. :biggrin: