AnimateWindow
Declare Function AnimateWindow Lib "user32" alias "AnimateWindow" _
(ByVal hwnd As Long, ByVal dwTime As Long, ByVal dwFlags As Long) As long
'------------------------------------------------------------------------------|
' hwnd Handle to the window to animate. The calling thread must |
' own this window. |
' |
' dwTime Specifies how long it takes to play the animation, in |
' milliseconds. Typically, an animation takes 200 |
' milliseconds to play. |
' |
' dwFlags Specifies the type of animation. This parameter can be one|
' or more of the following values. |
' |
' AW_SLIDE Uses slide animation. By default, roll animation is used. |
' This flag is ignored when used with AW_CENTER. |
' |
' AW_ACTIVATE Activates the window. Do not use this value with AW_HIDE. |
' |
' AW_BLEND Uses a fade effect. This flag can be used only if hwnd is |
' a top-level window. |
' |
' AW_HIDE Hides the window. By default, the window is shown. |
' |
' AW_CENTER Makes the window appear to collapse inward if AW_HIDE is |
' used or expand outward if the AW_HIDE is not used. |
' |
' AW_HOR_POSITIVE Animates the window from left to right. This flag can be |
' used with roll 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 slide animation. It is ignored when used|
' with AW_CENTER or AW_BLEND. |
' |
' AW_VER_POSITIVE Animates the window from top to bottom. This flag can be |
' used with roll or 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. It is ignored when used|
' with AW_CENTER or AW_BLEND. |
'------------------------------------------------------------------------------|
'------------------------------------------------------------------------------|
' If the function succeeds, the return value is nonzero. |
' If the function fails, the return value is zero. The function will fail in |
' the following situations: |
' |
' The window uses the window region. |
' The window is already visible and you are trying to show the window. |
' The window is already hidden and you are trying to hide the window. |
' To get extended error information, call the GetLastError function. |
'------------------------------------------------------------------------------|
Const AW_HOR_POSITIVE = &H1 'Animates the window from left to right. This flag can be used with roll or slide animation.
Const AW_HOR_NEGATIVE = &H2 'Animates the window from right to left. This flag can be used with roll or slide animation.
Const AW_VER_POSITIVE = &H4 'Animates the window from top to bottom. This flag can be used with roll or slide animation.
Const AW_VER_NEGATIVE = &H8 'Animates the window from bottom to top. This flag can be used with roll or slide animation.
Const AW_CENTER = &H10 'Makes the window appear to collapse inward if AW_HIDE is used or expand outward if the AW_HIDE is not used.
Const AW_HIDE = &H10000 'Hides the window. By default, the window is shown.
Const AW_ACTIVATE = &H20000 'Activates the window.
Const AW_SLIDE = &H40000 'Uses slide animation. By default, roll animation is used.
Const AW_BLEND = &H80000 'Uses a fade effect. This flag can be used only if hwnd is a top-level window.
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Start of demo code ~~~~~~~~~~~~~~~
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
declare sub showchild
declare sub hidechild
dim parentform as qform
parentform.center
dim b as qbutton
with b
.parent = parentform
.onclick = showchild
end with
dim childform as qform
childform.parent = parentform
childform.onclose = hidechild
parentform.showmodal
sub showchild
animatewindow(childform.handle, 400, AW_ROLL OR AW_VER_POSITIVE)
childform.show ' It's needed to make the bordericons work
end sub
sub hidechild
animatewindow(childform.handle, 400, AW_HIDE OR AW_ROLL OR AW_VER_NEGATIVE)
childform.close ' Needed (see above)
end sub
|