VB icon

Cool effects on form unload

Email
Submitted on: 2/3/2015 8:24:00 AM
By: Fosters (from psc cd)  
Level: Beginner
User Rating: By 3 Users
Compatibility: VB 4.0 (32-bit), VB 5.0, VB 6.0
Views: 690
 
     Paste into a fresh project's form1. on unloading the form, you can specify combination effects on how the form will disappear. This code is *not* mine, I found it on allapi.net. Simple effects that lend a touch of professionalism to an application. hope u like.
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
'**************************************
' Name: Cool effects on form unload
' Description:Paste into a fresh project's form1. on unloading the form, you can specify combination effects on how the form will disappear. This code is *not* mine, I found it on allapi.net. Simple effects that lend a touch of professionalism to an application. hope u like.
' By: Fosters (from psc cd)
'**************************************

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.
Private Declare Function AnimateWindow Lib "user32" (ByVal hwnd As Long, ByVal dwTime As Long, ByVal dwFlags As Long) As Boolean
Private Sub Form_Load()
'Credit to: http://www.allapi.net/
Me.AutoRedraw = True
Me.Print "Unload me"
End Sub
Private Sub Form_Unload(Cancel As Integer)
'Animate the window
AnimateWindow Me.hwnd, 300, AW_BLEND Or AW_HIDE
'Unload our form completely
Set Form1 = Nothing
End Sub


Other 23 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.