VB.NET:
Imports System.Runtime.InteropServices
Inherits System.Windows.Forms.Form
<StructLayout(LayoutKind.Sequential)> Private Structure SHFILEOPSTRUCT
Dim hwnd As Integer
Dim wFunc As Integer
Dim pFrom As String
<MarshalAs(UnmanagedType.LPStr)> Dim pTo As String
Dim fFlags As Short
Dim fAnyOperationsAborted As Boolean
Dim hNameMappings As Integer
<MarshalAs(UnmanagedType.LPStr)> Dim lpszProgressTitle As String
End Structure
Private Const FO_copy As Integer = &H2
Private Const FOF_simpleprogress As Integer = &H100
Private Const FOF_NoConfirmation As Integer = &H10
Private Const FO_delete As Integer = &H3
Private Const FOF_allowundo As Integer = &H40
Private Const FOF_filesonly As Integer = &H80
Private Const fof_multidestfiles As Integer = &H1
Dim X As SHFILEOPSTRUCT
Private Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" (ByRef lpFileOp As SHFILEOPSTRUCT) As Integer
Private Sub Command1_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command1.Click
X.pFrom = "c:\Mydata\*.*"
X.pTo = "c:\copytest"
X.fFlags = FOF_NoConfirmation
X.wFunc = FO_copy
SHFileOperation(X)
End Sub
it will not accept *.*
it tells me it cannot read from the source file or disk.
it works on individual files or complete folder.
any ideas????
Last edited by a moderator: