static bool operate(FO func, string[] fileNames, string pTo, FOF flags, IntPtr handle) { SHFILEOPSTRUCT shell = new SHFILEOPSTRUCT(); shell.hwnd = handle; shell.wFunc = func; shell.pFrom = string.Empty; foreach (string fileName in fileNames) { shell.pFrom += fileName + '\0'; } shell.pFrom += '\0'; shell.pTo = pTo; shell.fFlags = flags; shell.fAnyOperationsAborted = false; shell.hNameMappings = IntPtr.Zero; shell.lpszProgressTitle = string.Empty; return (Shell32.SHFileOperation(ref shell) == 0); }
extern public static int SHFileOperation(ref SHFILEOPSTRUCT lpFileOp);
public extern static int SHFileOperation(ref SHFILEOPSTRUCT lpFileOp);