Ejemplo n.º 1
0
            ref SHFILEOPSTRUCT64 lpFileOp);         // Address of an SHFILEOPSTRUCT structure that contains information

        // this function needs to carry out the specified operation. This
        // parameter must contain a valid value that is not NULL. You are
        // responsibile for validating the value. If you do not validate it,
        // you will experience unexpected results.


        public static Int32 SHFileOperation(ref SHFILEOPSTRUCT lpFileOp)
        {
            MachineType mt = GetMachineType();
            Int32       result;

            switch (mt)
            {
            case MachineType.win32:
                SHFILEOPSTRUCT32 fos32 = new SHFILEOPSTRUCT32(lpFileOp);
                result = SHFileOperation32(ref fos32);
                lpFileOp.CopyFrom(fos32);
                break;

            case MachineType.win64:
                SHFILEOPSTRUCT64 fos64 = new SHFILEOPSTRUCT64(lpFileOp);
                result = SHFileOperation64(ref fos64);
                lpFileOp.CopyFrom(fos64);
                break;

            default:
                throw new ArgumentException("Hell, what kind of computer are you using? It's not 32 and not 64 bit");
            }

            return(result);
        }
Ejemplo n.º 2
0
        // this function needs to carry out the specified operation. This
        // parameter must contain a valid value that is not NULL. You are
        // responsibile for validating the value. If you do not validate it,
        // you will experience unexpected results.
        public static Int32 SHFileOperation(ref SHFILEOPSTRUCT lpFileOp)
        {
            MachineType mt = GetMachineType();
            Int32 result;

            switch (mt)
            {
                case MachineType.win32:
                    SHFILEOPSTRUCT32 fos32 = new SHFILEOPSTRUCT32(lpFileOp);
                    result = SHFileOperation32(ref fos32);
                    lpFileOp.CopyFrom(fos32);
                    break;

                case MachineType.win64:
                    SHFILEOPSTRUCT64 fos64 = new SHFILEOPSTRUCT64(lpFileOp);
                    result = SHFileOperation64(ref fos64);
                    lpFileOp.CopyFrom(fos64);
                    break;

                default:
                    throw new ArgumentException("Hell, what kind of computer are you using? It's not 32 and not 64 bit");
            }

            return result;
        }