PDA

Click to See Complete Forum and Search --> : Animate Window API Problem


venkatraman_r
Dec 2nd, 1999, 12:01 PM
Hi, I tried to use the animatewindow API. But when i unload my form, i got an error message saying,

"Can't find Dll entry point in animatewindow in user32"

What could be the reason? Here is my code:

---------------------------------
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()
Me.AutoRedraw = True
Me.Print "Unload me"
End Sub
Private Sub Form_Unload(Cancel As Integer)
'Animate the window
AnimateWindow Me.hwnd, 200, AW_VER_POSITIVE Or AW_HOR_NEGATIVE Or AW_HIDE
'Unload our form completely
Set Form1 = Nothing
End Sub

--------------

Venkat.

Inhumanoid
Dec 2nd, 1999, 02:34 PM
I program of mine does that too.... On some machines...

I just compiled your program and it worked..

I think it 's not the code but it's the machine...

Do you have a Win95 OS maybe ??
My program never worked on Win95 but does in Win98...

You can however do about the same trick with a simple For loop...

venkatraman_r
Dec 2nd, 1999, 04:33 PM
Hi I Use Win NT. Any solutions??
Pls..

Inhumanoid
Dec 2nd, 1999, 07:01 PM
Maybe updating your system will help -->
IE 5, service packs etc...

if not.... I reckon the code is only fully compatible with win98..

You can still mimick it with a for loop.

Get the width and height and top and left of the window then hide the window and show a window with the same width, height, top and left but with it's borderstyle set to 0 (make the backcolor black)

Then do something like this to the window you just spawned :


dim iCounter as integer
Form2.Height = 5000
Form2.Width = 5000

For iCounter = 5000 To 1 Step -1
Form2.Height = iCounter
Form2.Width = iCounter
Form2.Top = Form2.Top + 1
DoEvents
Next iCounter

Unload Form2


[This message has been edited by Inhumanoid (edited 12-03-1999).]

Inhumanoid
Dec 2nd, 1999, 07:04 PM
hey venkatraman_r,

I just found out... Animatewindow is Windows 98 and Windows 2000 only .... :(

B.T.W. It's fun like this :


For iCounter = 5000 To 1 Step -4
Form1.Height = iCounter
Form1.Width = iCounter
Form1.Top = Form1.Top + 2
Form1.Left = Form1.Left + 2
DoEvents
Next iCounter


[This message has been edited by Inhumanoid (edited 12-03-1999).]

venkatraman_r
Dec 5th, 1999, 10:45 AM
Hi Inhumanoid,

Thanx for your help....i hope i would find a better way to animate a form other than this API and thanx for the informations.

Regards,

Venkat :)