From: Luigino M. <lma...@ou...> - 2002-10-08 16:12:42
|
This is a working demo for Animated windows #------------------------------------- use Win32; use Win32::API; use Win32::GUI; use constant AW_HOR_POSITIVE =3D> 0x00000001; use constant AW_HOR_NEGATIVE =3D> 0x00000002; use constant AW_VER_POSITIVE =3D> 0x00000004; use constant AW_VER_NEGATIVE =3D> 0x00000008; use constant AW_CENTER =3D> 0x00000010; use constant AW_HIDE =3D> 0x00010000; use constant AW_ACTIVATE =3D> 0x00020000; use constant AW_SLIDE =3D> 0x00040000; use constant AW_BLEND =3D> 0x00080000; # BOOL AnimateWindow( # HWND hwnd, # DWORD dwTime, # DWORD dwFlags # ); my $AnimateWindow =3D new Win32::API("user32", "AnimateWindow", [ 'N', = 'N', 'N' ], 'N') or $reg{'UI'}{'Fading'} =3D 0; # ... here create your window object ($winObj) as ususal... my $winObj =3D Win32::GUI::Window->new( -name =3D> 'Main', -width =3D> = 200, -height =3D> 200, -left =3D> 200, -top =3D> 200 ); # add a label to your window $winObj->AddLabel(-text =3D> "Hello, world", -name =3D> 'label'); # set animation duration in ms (usually 200ms) my $msec =3D 300; # FADE IN # use this command in place of $objWin->Show() $AnimateWindow->Call($winObj->{-handle}, $msec, AW_ACTIVATE | AW_BLEND = ); # activate dialog processing Win32::GUI::Dialog(); sub Main_Terminate { # FADE OUT # use this command in place of $objWin->Hide() for example in = winObj_Terminate() $AnimateWindow->Call($winObj->{-handle}, $msec, AW_HIDE | AW_BLEND ); return(-1); } # Some alternatives follows... # APPEAR from LEFT-TOP # use this command in place of $objWin->Show() # $AnimateWindow->Call($winObj->{-handle}, $msec, AW_ACTIVATE | AW_SLIDE = | AW_HOR_POSITIVE | AW_VER_POSITIVE ); # DISAPPEAR from RIGHT-BOTTOM # use this command in place of $objWin->Hide() for example in = winObj_Terminate() # $AnimateWindow->Call($winObj->{-handle}, $msec, AW_HIDE | AW_SLIDE | = AW_HOR_NEGATIVE | AW_VER_NEGATIVE ); # GROW from CENTER # use this command in place of $objWin->Show() # $AnimateWindow->Call($winObj->{-handle}, $msec, AW_ACTIVATE | = AW_CENTER ); # SHRINK to CENTER # use this command in place of $objWin->Hide() for example in = winObj_Terminate() # $AnimateWindow->Call($winObj->{-handle}, $msec, AW_HIDE | AW_CENTER ); |