LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Userform animation

Thanks very much - I'll give that a go :)

Jeff

"Michel Pierron" wrote in message
...
Hi Jeff;
You need the small animation files of Windows (avi).
In your userform module:

Private Declare Function CreateWindowEX Lib "user32" Alias _
"CreateWindowExA" (ByVal dwExStyle As Long _
, ByVal lpClassName As String, ByVal lpWindowName As String _
, ByVal dwStyle As Long, ByVal x As Long, ByVal y As Long _
, ByVal nWidth As Long, ByVal nHeight As Long _
, ByVal hWndParent As Long, ByVal hMenu As Long _
, ByVal hInstance As Long, lpParam As Any) As Long
Private Declare Function DestroyWindow _
Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function SetParent Lib "user32" _
(ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias _
"SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long _
, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function FindWindow Lib "user32" Alias _
"FindWindowA" (ByVal lpClassName As String _
, ByVal lpWindowName As String) As Long

Private Sub CommandButton1_Click()
Me.Repaint
Const aviFile As String = "\copySetupFiles.avi"
If Dir(ThisWorkbook.Path & aviFile) = "" Then Exit Sub
Dim hwnd As Long, W As Long, H As Long
Dim anhWnd As Long, pbhWnd As Long
hwnd = FindWindow(vbNullString, Me.Caption)
W = Me.InsideWidth * 4 / 3
H = Me.InsideHeight * 4 / 3
' Animation
anhWnd = CreateWindowEX(0, "SysAnimate32", "" _
, &H50000007, 0, 0, W, 40, hwnd, 0, 0, 0)
SetParent anhWnd, hwnd
' ProgressBar (Leds: &H50000000 / Smooth: &H50000001)
pbhWnd = CreateWindowEX(0, "msctls_progress32", "" _
, &H50000000, 0, H - 20, W, 20, hwnd, 0, 0, 0)
SetParent pbhWnd, hwnd
Const iMax As Long = 50000
Dim i As Long, iVal As String
SendMessage anhWnd, &H464, 0&, ByVal ThisWorkbook.Path & aviFile
For i = 1 To iMax
DoEvents
iVal = Format(i / iMax, "0%")
SendMessage pbhWnd, &H402, ByVal Val(iVal), 0&
Next i
DestroyWindow pbhWnd
DestroyWindow anhWnd
End Sub

Regards
MP

"Jeff Standen" a écrit dans le message

de
...
Hi all,

Is there any way to get the Windows animation for copying a file (or
downloading a file) on to a user form?

Cheers,
Jeff






 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
animation in excel PVR Excel Discussion (Misc queries) 2 February 2nd 10 08:24 PM
animation in excel Jim Excel Worksheet Functions 1 March 5th 07 08:57 PM
Animation Weave New Users to Excel 1 December 7th 05 02:21 PM
Animation Adam Klee Excel Programming 3 August 12th 03 01:15 PM
animation Adam Klee Excel Programming 0 August 12th 03 08:04 AM


All times are GMT +1. The time now is 02:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"