|
-
Nov 12th, 2000, 06:08 AM
#1
Thread Starter
Lively Member
Hi, any ideas on making an animated progress kinda thing as in the explorer copying file box? (you know the two folders with the paper flying from one to the other?) does anyone know where i can find some of the animations and how i can display then while performing large operations to let the user know we're still alive?
Daniel Rose
VB 5.0 Enterprise.
irc:irc2.dynam.ac
If TheCodeInTheSig() Is Not Lame() Then IDontKnowWhatIs()
-
Nov 12th, 2000, 07:56 AM
#2
Hyperactive Member
hi,
About the animation that windows display when copying things,
well it's an avi in another form that opens in Modal way so
you can't interact with the calling or process form.
To make that you just load the avi in the little form and
start playing it when you begin the process and stop it
when the process is finished, and as in explorer there will
be the same problem that the animation could be "alive" but
the process could be "dead", that's what i think about it so
far.
Maybe someone else has the solution, but as far as i have
seen a dead process won't scream
Saludos...
"Who Dares Wins" - "Quien se Arriesga Gana"
Mail me at: 
-
Nov 12th, 2000, 08:19 AM
#3
Hyperactive Member
You can find some graphics and animations in the 'Graphics' folder in the VB folder.
-
Nov 13th, 2000, 04:11 AM
#4
Thread Starter
Lively Member
Hmmm, how can i play the avi? i have tried ActiveMovie control but i just get some System Error when i execute my program when this control is in use...
Daniel Rose
VB 5.0 Enterprise.
irc:irc2.dynam.ac
If TheCodeInTheSig() Is Not Lame() Then IDontKnowWhatIs()
-
Nov 13th, 2000, 04:43 AM
#5
Lively Member
Here is the way to do it !...
Module Code :
-------------
'Copies the files specified in the pFrom member to the location specified in the pTo member.
Private Const FO_COPY = &H2&
'Deletes the files specified in pFrom (pTo is ignored.)
Private Const FO_DELETE = &H3&
Private Const FO_MOVE = &H1& 'Moves the files specified in pFrom to the location specified in pTo.
Private Const FO_RENAME = &H4& 'Renames the files specified in pFrom.
Private Const FOF_ALLOWUNDO = &H40& 'Preserve Undo information.
Private Const FOF_CONFIRMMOUSE = &H2& 'Not currently implemented.
'handle to the parent window for the progress dialog box.
Private Const FOF_CREATEPROGRESSDLG = &H0&
'Perform the operation on files only if a wildcard file name (*.*) is specified.
Private Const FOF_FILESONLY = &H80&
'The pTo member specifies multiple destination files (one for each source file) rather than one directory where all source files are to be deposited.
Private Const FOF_MULTIDESTFILES = &H1&
'Respond with Yes to All for any dialog box that is displayed.
Private Const FOF_NOCONFIRMATION = &H10&
'Does not confirm the creation of a new directory if the operation requires one to be created.
Private Const FOF_NOCONFIRMMKDIR = &H200&
'operated on a new name in a move, copy, or rename operation if a file with the target name already exists.
Private Const FOF_RENAMEONCOLLISION = &H8&
'Does not display a progress dialog box.
Private Const FOF_SILENT = &H4&
'Displays a progress dialog box but does not show the file names.
Private Const FOF_SIMPLEPROGRESS = &H100&
'If FOF_RENAMEONCOLLISION is specified, the hNameMappings member will be filled in if any files were renamed.
Private Const FOF_WANTMAPPINGHANDLE = &H20&
'
'
' The SHFILOPSTRUCT is not double-word aligned. If no steps are
' taken, the last 3 variables will not be passed correctly. This
' has no impact unless the progress title needs to be changed.
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 Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long)
Private Declare Function SHFileOperation Lib "Shell32.dll" Alias "SHFileOperationA" (lpFileOp As Any) As Long
Source Code :
CopyOfFiles:
Label3.Caption = "Copy in progress..."
Dim result As Long, lenFileop As Long
Dim foBuf() As Byte
Dim fileop As SHFILEOPSTRUCT
' ==================================================================================================== ============
lenFileop = LenB(fileop) ' double word alignment increase
ReDim foBuf(1 To lenFileop) ' the size of the structure.
With fileop
.hwnd = Me.hwnd
.wFunc = FO_COPY
' The files to copy separated by Nulls and terminated by two nulls
.pFrom = SourceFile & "\*.*" & vbNullChar & vbNullChar
' .fFlags = FOF_SIMPLEPROGRESS Or FOF_FILESONLY
.pTo = DestPath & vbNullChar & vbNullChar
End With
Copie:
' Now we need to copy the structure into a byte array
Call CopyMemory(foBuf(1), fileop, lenFileop)
' Next we move the last 12 bytes by 2 to byte align the data
Call CopyMemory(foBuf(19), foBuf(21), 12)
result = SHFileOperation(foBuf(1))
If result <> 0 Then ' Operation failed
Select Case Err.LastDllError
Case 0: MsgBox "Operation cancel...", vbInformation: Exit Sub
Case 2: GoTo Copie
Case Else ' Show the error returned from the API.
MsgBox Err.LastDllError & " - Error when removing files", vbCritical
End Select
Else
If fileop.fAnyOperationsAborted <> 0 Then
MsgBox "Operation Failed", vbCritical
Exit Sub
End If
End If
-
Nov 13th, 2000, 04:48 AM
#6
Thread Starter
Lively Member
Daniel Rose
VB 5.0 Enterprise.
irc:irc2.dynam.ac
If TheCodeInTheSig() Is Not Lame() Then IDontKnowWhatIs()
-
Nov 13th, 2000, 05:32 AM
#7
Lively Member
Eh oui ! En Anglais !...
In fact, I found the article on the TECHNET or MSDN.
Then, I use it in one of my VB program.
Good luck,
Thierry Demoy (FRANCE)
-
Nov 13th, 2000, 07:20 AM
#8
_______
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Nov 13th, 2000, 11:45 AM
#9
try the animation control in the 'Microsoft Windows Common COntrols 2-6.0' component then throw in some code like this:
Code:
Private Sub Command1_Click()
If Me.Tag = "playing" Then
animation1.Stop
Me.Tag = "stopped"
Else
animation1.Play
Me.Tag = "playing"
End If
End Sub
Private Sub Form_Load()
animation1.Open "C:\Program Files\Microsoft Visual Studio\Common\Graphics\Videos\filecopy.avi"
End Sub
-
Nov 13th, 2000, 04:27 PM
#10
Hyperactive Member
How about jus using Windows Media Player Control???
This is the easiest control ever made for playing sound and video!
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
|