Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Option Explicit
Private Type SHFILEOPSTRUCT
hWnd As Long
wFunc As Long
pFrom As String
pTo As String
fFlags As Integer
fAnyOperationsAborted As Boolean
hNameMappings As Long
lpszProgressTitle As String
End Type
Private Declare Function SHFileOperation _
Lib "shell32.dll" _
Alias "SHFileOperationA" _
(lpFileOp As SHFILEOPSTRUCT) As Long
Private Const FO_COPY = &H2
Private Const FOF_NOCONFIRMATION = &H10 ' Don't prompt the user.
Private Const FOF_NOCONFIRMMKDIR = &H200 ' don't confirm making any needed dirs
Private Function MyCopy(ByVal sSource As String, _
ByVal sTarget As String) As Boolean
Dim sh_op As SHFILEOPSTRUCT
With sh_op
.hWnd = 0
.wFunc = FO_COPY
.pFrom = sSource & vbNullChar & vbNullChar
.pTo = sTarget & vbNullChar & vbNullChar
.fFlags = FOF_NOCONFIRMATION Or FOF_NOCONFIRMMKDIR
End With
If SHFileOperation(sh_op) = 0 Then
MyCopy = True
Else
MyCopy = False
If sh_op.fAnyOperationsAborted Then
MsgBox "Unable to copy " & sSource & " to " & _
sTarget & " (User aborted operation)", vbExclamation
Else
MsgBox "Unable to copy " & sSource & " to " & _
sTarget & " (Unknown error)", vbExclamation
End If
End If
End Function
Private Sub Command1_Click()
Dim sSource As String
Dim sTarget As String
sSource = "F:\From I\downloads\aviss\sheep-intro.avi"
sTarget = "J:\1\2\3\4\5\6\sheep-intro.avi"
If MyCopy(sSource, sTarget) Then
MsgBox "OK", vbInformation
End If
End Sub