Uwe,
There is a windows API call to do window animation. I found the code below in my archives. I know it works on XP but I don't know if it works on newer windows versions.
James
Code: Select all | Expand
/*
It's possible to close Window and Dialog with Fade out or Fade in effect ?
How to ? What to do for Fw2.1c user ?
From: "Morris D'Andrea" <m_dandrea@cogeco.ca>
Subject: Re: Give me some idea...
Date: Wednesday, October 05, 2005 9:22 PM
Here is an attached example using the Animatewindow API call. used Fw2.1c
blinker 6 , tested under windows 2000 and 98. Various effects on a dialog
and window including fade, slide, from center, from top left , from top
right are in the example.
Morris
Oops forgot to mention you may want to play with the second parameter in the
api call in the example below it is set to 500 , you may want to increase
for faster systems or decrease it for slower ones ( makes the effect
smoother depending on CPU speed ) .
AnimateWnd(gethwnd32(ownd:hwnd), 500, nor(AW_BLEND,AW_HIDE) )
Morris
*/
#include "fivewin.ch"
#define AW_HOR_POSITIVE 1 //Animates the window from left to right. This flag can be used with roll or slide animation.
#define AW_HOR_NEGATIVE 2 //Animates the window from right to left. This flag can be used with roll or slide animation.
#define AW_VER_POSITIVE 4 //Animates the window from top to bottom. This flag can be used with roll or slide animation.
#define AW_VER_NEGATIVE 8 //Animates the window from bottom to top. This flag can be used with roll or slide animation.
#define AW_CENTER 16 //Makes the window appear to collapse inward if AW_HIDE is used or expand outward if the AW_HIDE is not used.
#define AW_HIDE 65536 //Hides the window. By default, the window is shown
#define AW_ACTIVATE 131072 //Activates the window.
#define AW_SLIDE 262144 //Uses slide animation. By default, roll animation is used.
#define AW_BLEND 524288 //Uses a fade effect.This flag can be used only if hwnd is a top-level window.
static odlg
static ownd
function main()
DEFINE WINDOW oWnd ;
color "N/B*";
TITLE "Window Animation Effects";
MENU BUILDMENU()
ACTIVATE WINDOW ownd ON init size_it(ownd) ;
valid close_wnd(ownd)
return(NIL)
function size_it(ownd)
// Important if any part of the window is drawn
// past the top of screen or the bottom of window
// is beyond the taskbar the window hides first and
// then the effect is applied dialogs seem to work fine
// (tested with FW 2.1c)
SetWindowPos( ownd:hWnd, 0,0, 0,;
getsysmetrics(0) ,;
getsysmetrics(1) - 29)
bringwindowtotop(gethwnd32(ownd:hwnd))
ownd:setfocus()
return(NIL)
FUNCTION BuildMenu()
LOCAL oMenu
MENU oMenu
MENUITEM OemToAnsi( "&Test Effects..." )
MENU
MENUITEM "Top Right Down..." ;
MESSAGE "Click here to Exit";
ACTION (toprightdown(ownd))
MENUITEM "Top Left Down..." ;
MESSAGE "Click here to Exit";
ACTION (topleftdown(ownd))
MENUITEM "Fade ..." ;
MESSAGE "Click here to Exit";
ACTION (Fade(ownd))
MENUITEM "From Center..." ;
MESSAGE "Click here to Exit";
ACTION (fromcenter(ownd))
MENUITEM "Open Dialog..." ;
MESSAGE "Click here to Exit";
ACTION (opendlg())
MENUITEM "E&xit..." ;
MESSAGE "Click here to Exit";
ACTION (ownd:end())
ENDMENU
ENDMENU
RETURN( oMenu )
function opendlg(ownd)
local ctitle
cTitle := "Dialog Fade"
DEFINE DIALOG oDlg FROM 5,10 TO 24, 55 TITLE cTitle ;
COLOR "N/W"
@ 2, 7 BUTTON "&Top Right Down" OF oDlg SIZE 70, 12 ;
ACTION toprightdown(odlg)
@ 4, 7 BUTTON "&Top Left Down" OF oDlg SIZE 70, 12 ;
ACTION topleftdown(odlg)
@ 6, 7 BUTTON "&From Center" OF oDlg SIZE 70, 12 ;
ACTION fromcenter(odlg)
@ 8, 7 BUTTON "&Fade dialog" OF oDlg SIZE 70, 12 ;
ACTION fade(odlg)
ACTIVATE DIALOG oDlg CENTERED ;
on init bringwindowtotop(gethwnd32(odlg:hwnd)) ;
valid close_wnd(odlg)
return NIL
function topleftdown(thewnd)
thewnd:hide()
AnimateWnd( gethwnd32(thewnd:hwnd), 200, AW_VER_POSITIVE + AW_HOR_POSITIVE + AW_SLIDE)
thewnd:setfocus()
return(NIL)
function toprightdown(thewnd)
thewnd:hide()
AnimateWnd( gethwnd32(thewnd:hwnd), 200, AW_VER_POSITIVE + AW_HOR_NEGATIVE + AW_SLIDE)
thewnd:setfocus()
return(NIL)
function fromcenter(thewnd)
thewnd:hide()
AnimateWnd( gethwnd32(thewnd:hwnd), 200, AW_CENTER)
thewnd:setfocus()
return(NIL)
function fade(thewnd)
AnimateWnd( gethwnd32(thewnd:hwnd), 200, AW_BLEND + AW_HIDE)
msginfo("Window Faded")
thewnd:show()
thewnd:setfocus()
return(NIL)
function close_wnd(ownd)
AnimateWnd(gethwnd32(ownd:hwnd), 1000, nor(AW_BLEND,AW_HIDE) )
do while iswindowvisible(ownd:hwnd)
sysrefresh()
enddo
return(.t.)
DLL32 Function AnimateWnd(hwnd As LONG, dwTime As LONG,dwFlags As LONG) As BOOL;
PASCAL FROM "AnimateWindow" Lib "user32"