|
-
Oct 26th, 2001, 05:34 AM
#1
Thread Starter
Hyperactive Member
Problem with AnimateWindow()
Hi,
I tried the following code to try to 'disolve' a form window but when i press the button, nothing happens. Know why?
Pls tell me , many many thanx~!
VB Code:
Option Explicit
Private Declare Function AnimateWindow Lib "user32" ( _
ByVal hwnd As Long, _
ByVal dwTime As Long, _
ByVal dwFlags As Long _
) As Boolean
Const AW_BLEND = &H80000 'Uses a fade effect. This flag can be used only if hwnd is a top-level window.
Const AW_SLIDE = &H40000
Private Sub Command1_Click()
Me.AutoRedraw = True
Dim RetVal
AnimateWindow Me.hwnd, 4000, AW_BLEND
End Sub
-
Oct 26th, 2001, 08:55 AM
#2
Try this:
VB Code:
Private Declare Function AnimateWindow Lib "user32" (ByVal hwnd As Long, ByVal dwTime As Long, ByVal dwFlags As Long) As Boolean
Private Const AW_HOR_POSITIVE = &H1 'Animates the window from left to right. This flag can be used with roll or slide animation.
Private Const AW_HOR_NEGATIVE = &H2 'Animates the window from right to left. This flag can be used with roll or slide animation.
Private Const AW_VER_POSITIVE = &H4 'Animates the window from top to bottom. This flag can be used with roll or slide animation.
Private Const AW_VER_NEGATIVE = &H8 'Animates the window from bottom to top. This flag can be used with roll or slide animation.
Private 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.
Private Const AW_HIDE = &H10000 'Hides the window. By default, the window is shown.
Private Const AW_ACTIVATE = &H20000 'Activates the window.
Private Const AW_SLIDE = &H40000 'Uses slide animation. By default, roll animation is used.
Private Const AW_BLEND = &H80000 'Uses a fade effect. This flag can be used only if hwnd is a top-level window.
Private Sub Form_Unload(Cancel As Integer)
AnimateWindow Me.hwnd, 200, AW_VER_POSITIVE Or AW_HOR_NEGATIVE Or AW_HIDE
End Sub
Private Sub Form_Load()
Me.AutoRedraw = True
End Sub
Take your code out of the command button click event and put it in the form_unload event (also, you dim RetVal and then don't do anything with it )
-
Oct 26th, 2001, 09:55 AM
#3
Thread Starter
Hyperactive Member
why did u put more than one flags when calling the function ??
And what does the 'Or' keyword do in that case. Also, i don't seem to get the aw_blend to work, but the code u gave me worked fine.
pls explain
thanx!@
-
Oct 26th, 2001, 11:52 AM
#4
Flag bits are set or are clear in the constant. Or sets all the bits from each flag, so the effect is combined.
-
Oct 26th, 2001, 12:04 PM
#5
Callieo beat me to it.
-
Oct 27th, 2001, 06:39 AM
#6
Thread Starter
Hyperactive Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|