The MASM Forum

General => The Workshop => Topic started by: bluedevil on November 04, 2012, 09:42:29 AM

Title: Dialog Animations - AnimateWindow API and RadioButton Usage
Post by: bluedevil 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.

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
Title: Re: Dialog Animations - AnimateWindow API and RadioButton Usage
Post by: ragdog on November 04, 2012, 10:48:53 PM
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
Title: Re: Dialog Animations - AnimateWindow API and RadioButton Usage
Post by: 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.
Title: Re: Dialog Animations - AnimateWindow API and RadioButton Usage
Post by: bluedevil on November 05, 2012, 12:15:04 AM
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
Title: Re: Dialog Animations - AnimateWindow API and RadioButton Usage
Post by: bluedevil on November 05, 2012, 12:33:18 AM
@ragdog, thanks for your optimization :t
i have edited the sources according to your optmization
Title: Re: Dialog Animations - AnimateWindow API and RadioButton Usage
Post by: 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 
Title: Re: Dialog Animations - AnimateWindow API and RadioButton Usage
Post by: bluedevil on November 05, 2012, 04:32:28 AM
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:
Title: Re: Dialog Animations - AnimateWindow API and RadioButton Usage
Post by: FORTRANS 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.
Title: Re: Dialog Animations - AnimateWindow API and RadioButton Usage
Post by: Gunther on November 06, 2012, 02:50:12 AM
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
Title: Re: Dialog Animations - AnimateWindow API and RadioButton Usage
Post by: Bill Cravener 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. ;)
Title: Re: Dialog Animations - AnimateWindow API and RadioButton Usage
Post by: Gunther on November 06, 2012, 04:38:06 AM
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 
Title: Re: Dialog Animations - AnimateWindow API and RadioButton Usage
Post by: Bill Cravener on November 06, 2012, 10:06:25 PM
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:
Title: Re: Dialog Animations - AnimateWindow API and RadioButton Usage
Post by: bluedevil 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:
Title: Re: Dialog Animations - AnimateWindow API and RadioButton Usage
Post by: Gunther on November 07, 2012, 07:52:57 AM
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
Title: Re: Dialog Animations - AnimateWindow API and RadioButton Usage
Post by: Bill Cravener 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:


(http://www.quickersoft.com/pictures/comp1.jpg) (http://www.quickersoft.com/pictures/comp2.jpg)
Title: Re: Dialog Animations - AnimateWindow API and RadioButton Usage
Post by: hutch-- on November 08, 2012, 10:17:03 PM
 :biggrin:

> 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.

It was cheaper than going to the gym too.  :P
Title: Re: Dialog Animations - AnimateWindow API and RadioButton Usage
Post by: Bill Cravener on November 08, 2012, 10:34:21 PM
Yes it was buddy!  ;)

Sex!! You know Steve, now that I'm in my 60's it just doesn't seem as important anymore. :biggrin:
Title: Re: Dialog Animations - AnimateWindow API and RadioButton Usage
Post by: hutch-- on November 08, 2012, 10:43:52 PM
Look on the bright side, they are all turning to blondes at my age.  :P
Title: Re: Dialog Animations - AnimateWindow API and RadioButton Usage
Post by: dedndave on November 09, 2012, 01:03:43 AM
Quote from: Bill Cravener on November 08, 2012, 09:19:20 PMWhat 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.

it's odd that they didn't mention that in the article   :lol:

seriously - nice job Bill   :t
back in the day (mid 80's), i was reading PC Tech Journal
Ray Duncan had an article in almost every issue
Title: Re: Dialog Animations - AnimateWindow API and RadioButton Usage
Post by: Bill Cravener on November 09, 2012, 02:12:16 AM
That was a long time ago Dave. As to sex and women, it wasn't so much the thing between my legs that got them girls excited back then, it was in fact the thing between my legs I rode that turned them on. In other words, it wasn't that big you know what, no sir, it was the big motorcycle that I rode back then that they wanted most. Sex was how those young beauties paid me back for the ride. :biggrin:
Title: Re: Dialog Animations - AnimateWindow API and RadioButton Usage
Post by: dedndave on November 09, 2012, 11:01:32 PM
i get that - lol
Z used to own a harley
her friends called it "Z's vibrator with a kick stand"   :biggrin:
Title: Re: Dialog Animations - AnimateWindow API and RadioButton Usage
Post by: Bill Cravener on November 09, 2012, 11:22:32 PM
Quote from: dedndave on November 09, 2012, 01:03:43 AM
back in the day (mid 80's), i was reading PC Tech Journal
Ray Duncan had an article in almost every issue

I have a couple of Ray's books in a box somewhere. I can't tell you how much I miss those days of programming in assembly. As I stated before if you did belong to a programming forum members contributed almost daily with either bits of source code or full program code sources. More often then not if you were not a contributor back then you were soon told to find another forum to hang out in. There were very few freeloaders tolerated back in those days. There were not all that many of us true asm lovers back then as I recall and most forum communities were made up of all the various programming languages with a section for each language. Besides CompuServe unlike today where everything is online most all programming information was in books and magazines back then. Yep, those were the good old days.

Here are a couple other publications that I received mention in way back then.

(http://www.quickersoft.com/pictures/ptools1.jpg)(http://www.quickersoft.com/pictures/ptools2.jpg)

(http://www.quickersoft.com/pictures/shopper.jpg)
Title: Re: Dialog Animations - AnimateWindow API and RadioButton Usage
Post by: dedndave on November 09, 2012, 11:49:03 PM
yes - i miss it, too
it seemed a lot simpler, back then

some of the programs they published were displayed as DEBUG scripts
the entire program took 10 or 20 lines of code - lol

it was fun to open debug, type in "a" and peck out the program   :P

as i became a little more capable, i wrote my own stuff
one of the first real utilities i wrote was a .SYS file that allowed you to
choose which .SYS files were loaded and which autoexec.bat file to use
Title: Re: Dialog Animations - AnimateWindow API and RadioButton Usage
Post by: Bill Cravener on November 10, 2012, 01:35:49 AM
I miss, you miss. . . .we really do sound like a couple old farts don't we? ;)

And it goes without saying that we all know Steve is an old fart! :biggrin:
Title: Re: Dialog Animations - AnimateWindow API and RadioButton Usage
Post by: dedndave on November 10, 2012, 07:27:52 AM
i think we all are - lol
so, our MASM32 t-shirt should read something like

        MASM32
Old Farts Still Do It
Title: Re: Dialog Animations - AnimateWindow API and RadioButton Usage
Post by: bluedevil on November 10, 2012, 08:52:02 AM
I am so lucky to be with these experts here :t
Title: Re: Dialog Animations - AnimateWindow API and RadioButton Usage
Post by: Gunther on November 10, 2012, 09:01:23 PM
Hi blue_devil,

Quote from: blue_devil on November 10, 2012, 08:52:02 AM
I am so lucky to be with these experts here :t

Oh no, we aren't such experts. Ray Duncan was one and Dave is an old fart.  :lol:

Gunther
Title: Re: Dialog Animations - AnimateWindow API and RadioButton Usage
Post by: bluedevil on November 10, 2012, 09:46:14 PM
Hi Gunther
You are really modest =)
Title: Re: Dialog Animations - AnimateWindow API and RadioButton Usage
Post by: Gunther on November 10, 2012, 09:50:26 PM
Hi blue_devil,

Quote from: blue_devil on November 10, 2012, 09:46:14 PM
Hi Gunther
You are really modest =)

thank you for the flowers, but never mind.

Gunther
Title: Re: Dialog Animations - AnimateWindow API and RadioButton Usage
Post by: hutch-- on November 10, 2012, 10:04:31 PM
If you go back into the DOS era, there were two source codes that I was impressd with, a BAT to COM file converter written by Keith P. Graham in MASM and the source code in MASM for DOS 5.0 command.com. Much of the other stuff around at the time was crap but these two were classy architecture and good coding.
Title: Re: Dialog Animations - AnimateWindow API and RadioButton Usage
Post by: Bill Cravener on November 10, 2012, 11:52:00 PM
Quote from: hutch-- on November 10, 2012, 10:04:31 PM
Much of the other stuff around at the time was crap but these two were classy architecture and good coding.

Back in the mid to late 80's and early 90's I thought Masm sucked compared to Eric Isaacson A86 assembler. Turbo Assembler by Borland was also preferred back then. Many of us who coded small utilities did so do to the fact that the company one worked for needed something specific to their needs. When I was working for Pyramid Fitness Industry's long ago a couple of the engineers who used AutoCAD for DOS said they wished that AutoCAD showed the time somewhere on the screen thus my little DIGCLK was created for that purpose. There were many little gizmos I created back then such as feeding DXF files to a CNC machine. A color palette setter that enabled custom text and background colors for office accounting software, amongst other things. A Company did not care how perfect the source code was in the least, what they wanted was that it worked and that you came up with a solution ASAP!

Back in those early days there were many of us hobbyist DOS programmers who thought what the heck if a small utility was useful to some of your peers perhaps it would be to others. The point is in the old days, rather the code was good or bad, it was always willingly given out to others who shared the same interest in computer programming. The thing I miss the most was there was very little anonymity about oneself back in the old BBS and CompuServe days and most of us used our real names without fear. Words posted on what few computer programming boards there were back then was generally backed up by a persons real name which gave much more credence to what was being said or discussed. Those early days online you did not have to fear exposing who you really were as we do in todays internet world.
Title: Re: Dialog Animations - AnimateWindow API and RadioButton Usage
Post by: Force on November 30, 2012, 12:02:08 PM
Hi Blue Devil its a Good example

and you have a great site  :t

Regards

Force
Title: Re: Dialog Animations - AnimateWindow API and RadioButton Usage
Post by: bluedevil on December 04, 2012, 07:30:48 AM
Quote from: Force on November 30, 2012, 12:02:08 PM
Hi Blue Devil its a Good example

and you have a great site  :t

Regards

Force
Great Thanks Force =)
I am so busy nowadays, i cant add anything =(
Regards