private static bool GetPrefferdDropEffect(IntPtr hwnd)
        {
            uint uFormat = PInvoke.RegisterClipboardFormat("Preferred DropEffect");
            bool flag    = false;

            if (PInvoke.OpenClipboard(hwnd))
            {
                try {
                    IntPtr clipboardData = PInvoke.GetClipboardData(uFormat);
                    if (!(clipboardData != IntPtr.Zero))
                    {
                        return(flag);
                    }
                    IntPtr source = PInvoke.GlobalLock(clipboardData);
                    try {
                        if (source != IntPtr.Zero)
                        {
                            byte[] destination = new byte[4];
                            Marshal.Copy(source, destination, 0, 4);
                            flag = (destination[0] & 2) != 0;
                        }
                    }
                    finally {
                        PInvoke.GlobalUnlock(clipboardData);
                    }
                }
                finally {
                    PInvoke.CloseClipboard();
                }
            }
            return(flag);
        }
        public static bool SetClipboardFileDropPaths(List <string> lstPaths, bool fCut, IntPtr hwnd)
        {
            string str = MakeFILEOPPATHS(lstPaths);

            if ((hwnd != IntPtr.Zero) && (str.Length > 1))
            {
                if (!PInvoke.OpenClipboard(hwnd))
                {
                    return(false);
                }
                PInvoke.EmptyClipboard();
                try {
                    DROPFILES structure = new DROPFILES();
                    structure.pFiles = Marshal.SizeOf(structure);
                    structure.fWide  = true;
                    IntPtr hMem = PInvoke.GlobalAlloc(0x42, (IntPtr)(Marshal.SizeOf(structure) + (str.Length * Marshal.SystemMaxDBCSCharSize)));
                    if (hMem != IntPtr.Zero)
                    {
                        IntPtr ptr = PInvoke.GlobalLock(hMem);
                        Marshal.StructureToPtr(structure, ptr, false);
                        Marshal.Copy(str.ToCharArray(), 0, PtrPlus(ptr, Marshal.SizeOf(structure)), str.Length);
                        PInvoke.GlobalUnlock(hMem);
                    }
                    IntPtr ptr3 = PInvoke.GlobalAlloc(0x42, (IntPtr)4);
                    if (ptr3 != IntPtr.Zero)
                    {
                        IntPtr destination = PInvoke.GlobalLock(ptr3);
                        byte[] source      = new byte[4];
                        source[0] = fCut ? ((byte)2) : ((byte)5);
                        Marshal.Copy(source, 0, destination, 4);
                        PInvoke.GlobalUnlock(ptr3);
                    }
                    if ((hMem != IntPtr.Zero) && (ptr3 != IntPtr.Zero))
                    {
                        uint uFormat = PInvoke.RegisterClipboardFormat("Preferred DropEffect");
                        PInvoke.SetClipboardData(15, hMem);
                        PInvoke.SetClipboardData(uFormat, ptr3);
                        return(true);
                    }
                }
                finally {
                    PInvoke.CloseClipboard();
                }
            }
            return(false);
        }
        private static List <string> ClipboardGetFileDropList(IntPtr hwnd)
        {
            List <string> list = new List <string>();

            if (PInvoke.OpenClipboard(hwnd))
            {
                try {
                    IntPtr clipboardData = PInvoke.GetClipboardData(15);
                    if (!(clipboardData != IntPtr.Zero))
                    {
                        return(list);
                    }
                    IntPtr hDrop = PInvoke.GlobalLock(clipboardData);
                    if (!(hDrop != IntPtr.Zero))
                    {
                        return(list);
                    }
                    try {
                        uint num = PInvoke.DragQueryFile(hDrop, uint.MaxValue, null, 0);
                        if (num > 0)
                        {
                            for (uint i = 0; i < num; i++)
                            {
                                StringBuilder lpszFile = new StringBuilder(260);
                                PInvoke.DragQueryFile(hDrop, i, lpszFile, lpszFile.Capacity);
                                if (lpszFile.Length > 0)
                                {
                                    list.Add(lpszFile.ToString());
                                }
                            }
                        }
                        return(list);
                    }
                    finally {
                        PInvoke.GlobalUnlock(clipboardData);
                    }
                }
                finally {
                    PInvoke.CloseClipboard();
                }
            }
            return(list);
        }
 public static bool ClipboardContainsFileDropList(IntPtr hwnd)
 {
     if ((hwnd != IntPtr.Zero) && PInvoke.OpenClipboard(hwnd))
     {
         try {
             for (uint i = PInvoke.EnumClipboardFormats(0); i != 0; i = PInvoke.EnumClipboardFormats(i))
             {
                 if (i == 15)
                 {
                     return(true);
                 }
             }
         }
         finally {
             PInvoke.CloseClipboard();
         }
     }
     return(false);
 }