Author Topic: Dialog Animations - AnimateWindow API and RadioButton Usage  (Read 14400 times)

blue_devil

  • Member
  • **
  • Posts: 86
    • SCTZine
Dialog Animations - AnimateWindow API and RadioButton Usage
« on: November 04, 2012, 09:42:29 AM »
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.
Code: [Select]
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:
SCTZine Assembly

ragdog

  • Member
  • ****
  • Posts: 530
Re: Dialog Animations - AnimateWindow API and RadioButton Usage
« Reply #1 on: November 04, 2012, 10:48:53 PM »
Many api calls use this

Code: [Select]
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--

  • Administrator
  • Member
  • ******
  • Posts: 4933
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Dialog Animations - AnimateWindow API and RadioButton Usage
« Reply #2 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.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

blue_devil

  • Member
  • **
  • Posts: 86
    • SCTZine
Re: Dialog Animations - AnimateWindow API and RadioButton Usage
« Reply #3 on: November 05, 2012, 12:15:04 AM »
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:
Code: [Select]
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:
SCTZine Assembly

blue_devil

  • Member
  • **
  • Posts: 86
    • SCTZine
Re: Dialog Animations - AnimateWindow API and RadioButton Usage
« Reply #4 on: November 05, 2012, 12:33:18 AM »
@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:
SCTZine Assembly

Gunther

  • Member
  • *****
  • Posts: 3517
  • Forgive your enemies, but never forget their names
Re: Dialog Animations - AnimateWindow API and RadioButton Usage
« Reply #5 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 
Get your facts first, and then you can distort them.

blue_devil

  • Member
  • **
  • Posts: 86
    • SCTZine
Re: Dialog Animations - AnimateWindow API and RadioButton Usage
« Reply #6 on: November 05, 2012, 04:32:28 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:
SCTZine Assembly

FORTRANS

  • Member
  • ****
  • Posts: 946
Re: Dialog Animations - AnimateWindow API and RadioButton Usage
« Reply #7 on: November 06, 2012, 02:11:48 AM »
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

  • Member
  • *****
  • Posts: 3517
  • Forgive your enemies, but never forget their names
Re: Dialog Animations - AnimateWindow API and RadioButton Usage
« Reply #8 on: November 06, 2012, 02:50:12 AM »
Hi blue_devil,

I didnt tested on 64bit thanks for trying :bgrin:

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

Gunther
Get your facts first, and then you can distort them.

Bill Cravener

  • Guest
Re: Dialog Animations - AnimateWindow API and RadioButton Usage
« Reply #9 on: November 06, 2012, 03:40:44 AM »
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

  • Member
  • *****
  • Posts: 3517
  • Forgive your enemies, but never forget their names
Re: Dialog Animations - AnimateWindow API and RadioButton Usage
« Reply #10 on: November 06, 2012, 04:38:06 AM »
Bill,

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 
Get your facts first, and then you can distort them.

Bill Cravener

  • Guest
Re: Dialog Animations - AnimateWindow API and RadioButton Usage
« Reply #11 on: November 06, 2012, 10:06:25 PM »
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:

blue_devil

  • Member
  • **
  • Posts: 86
    • SCTZine
Re: Dialog Animations - AnimateWindow API and RadioButton Usage
« Reply #12 on: November 07, 2012, 07:16:22 AM »
@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:
SCTZine Assembly

Gunther

  • Member
  • *****
  • Posts: 3517
  • Forgive your enemies, but never forget their names
Re: Dialog Animations - AnimateWindow API and RadioButton Usage
« Reply #13 on: November 07, 2012, 07:52:57 AM »
Bill,

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
Get your facts first, and then you can distort them.

Bill Cravener

  • Guest
Re: Dialog Animations - AnimateWindow API and RadioButton Usage
« Reply #14 on: November 08, 2012, 09:19:20 PM »
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: