|
-
Apr 21st, 2001, 09:51 AM
#1
Thread Starter
New Member
I am using the SHFileOperation Function to copy files from one location to another
this function contains a flag ( FOF_SIMPLEPROGRESS)
which displays a progress dialog while the files are being copied. However I cannot get the progress dialog to work. Can anybody see where I am going wrong any help is greatly appreciated
code in module
Public 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
Public Declare Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" _
(Destination As Any, Source As Any, ByVal Length As Long)
Public Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" _
(lpFileOp As Byte) As Long
Public Const FO_DELETE = &H3
Public Const FOF_ALLOWUNDO = &H40
Public Const FOF_FILESONLY = &H80
Public Const FO_COPY = &H2
Public Const FO_RENAME = &H4
Public Const FOF_SIMPLEPROGRESS = &H100
code in command button
Private Sub Command3_Click()
Dim fos As SHFILEOPSTRUCT
Dim sa(1 To 32) As Byte
Dim retval As Long
With fos
.hwnd = Form1.hwnd
.wFunc = FO_COPY
.pFrom = Combo1 & vbNullChar & vbNullChar
.pTo = Combo2 & vbNullChar & vbNullChar
.fFlags = FOF_SIMPLEPROGRESS Or FOF_ALLOWUNDO Or FOF_FILESONLY
.fAnyOperationsAborted = 0
.hNameMappings = 0
.lpszProgressTitle = "Copying Files vbNullChar"
End With
CopyMemory sa(1), fos, LenB(fos)
CopyMemory sa(19), sa(21), 12
retval = SHFileOperation(sa(1))
CopyMemory sa(21), sa(19), 12
CopyMemory fos, sa(1), Len(fos)
End Sub
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
|