//*************************************************************************** // Class Constructors // /// <summary> /// Provides a managed class to access Windows' Shell32.dll,SHFileOperation unmanaged code. /// </summary> public InteropShellFileOperation() { this.fFlags = new FILEOP_FLAGS(); this._ShFile = new SHFILEOPSSTRUCT(); this._ShFile.hwnd = IntPtr.Zero; this._ShFile.wFunc = FO_Func.FO_COPY; this._ShFile.pFrom = ""; this._ShFile.pTo = ""; this._ShFile.fAnyOperationsAborted = false; this._ShFile.hNameMappings = IntPtr.Zero; this._ShFile.lpszProgressTitle = ""; }
//*************************************************************************** // Public Methods // public bool Execute() { // Prepare the parameter flags. this._ShFile.fFlags = this.fFlags.Flag; // Execute the operation. int ReturnValue = SHFileOperation(ref this._ShFile); // Return error level. if (ReturnValue == 0) { return(true); } else { return(false); } }
//*************************************************************************** // Public Methods // public bool Execute() { // Prepare the parameter flags. this._ShFile.fFlags = this.fFlags.Flag; // Execute the operation. int ReturnValue = SHFileOperation(ref this._ShFile); // Return error level. if (ReturnValue == 0) return true; else return false; }