Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using animation of copying files

Status
Not open for further replies.

tg2003

IS-IT--Management
Feb 6, 2003
270
0
0
IL
Hi,

I would like to show a simple animation of copying files (you know, like the two folders when you copy files in Windows) while I'm copying the files in the background.

A. How can I do it?
B. The animation should be ran in concurrent to the copied files. Should it be a thread ?

Thanks in advance!
 
You may be able to get the OS to do it for you ...

Paste this into a Form with a Command button.

Private Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long
Private Type SHFILEOPSTRUCT
hwnd As Long
wFunc As Long
pFrom As String
pTo As String
fFlags As Integer
fAnyOperationsAborted As Long
hNameMappings As Long
lpszProgressTitle As String
End Type
Private Const FO_COPY = &H2
Private Const FOF_NOCONFIRMATION As Long = &H10
Private Const FOF_SIMPLEPROGRESS As Long = &H100

Private Sub CopyFile(ByVal src As String, ByVal dst As String)
Dim fos As SHFILEOPSTRUCT
fos.hwnd = hwnd
fos.pFrom = src
fos.pTo = dst
fos.wFunc = FO_COPY
'fos.fFlags = FOF_NOCONFIRMATION 'does not prompt if file aleady exists BUT progress bar is not displayed
'fos.fFlags = FOF_SIMPLEPROGRESS 'does not show file names in the progress window as the copy progresses
SHFileOperation fos
End Sub

Private Sub Command1_Click()

CopyFile "c:\SourceFolder\*.*", CurDir$ & "\DestFolder"

End Sub
 
Animation control:


Code:
Option Explicit
'Add a component Microsoft Windows Common Controls - 2

Private Sub cmdPlay_Click()
   anmAVI.Open "c:\program files\microsoft visual studio\common\" & _
     "Graphics\Videos\filemove.avi"
   ' Play the file indefinitely.
   anmAVI.Play
End Sub

Private Sub cmdStop_Click()
   anmAVI.Stop
End Sub

-David
2006, 2007 & 2008 Microsoft Most Valuable Professional (VB)
2006 Dell Certified System Professional (CSP)
 
BTW: How do I make my own AVI files?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top