public static uint RegisterShellNotify(IntPtr handle, ShellAPI.SHChangeNotifyEntry entry)
 {
     return ShellAPI.SHChangeNotifyRegister(
                                             handle,
                                             ShellAPI.SHCNRF.InterruptLevel | ShellAPI.SHCNRF.ShellLevel,
                                             ShellAPI.SHCNE.ALLEVENTS | ShellAPI.SHCNE.INTERRUPT,
                                             ShellAPI.WM.SH_NOTIFY,
                                             1,
                                             new ShellAPI.SHChangeNotifyEntry[] { entry });
 }
Exemplo n.º 2
0
 public DirectoryInfoEx(ShellAPI.CSIDL csidl)
 {
     PIDL pidlLookup = CSIDLtoPIDL(csidl);
     try
     {
         init(pidlLookup);
         checkProperties();
     }
     finally
     {
         if (pidlLookup != null) pidlLookup.Free();
         pidlLookup = null;
     }
 }
Exemplo n.º 3
0
        public int QueryContinueDrag(bool fEscapePressed, ShellAPI.MK grfKeyState)
        {
            int retVal = ShellAPI.S_OK;

            if (fEscapePressed)
                retVal = ShellAPI.DRAGDROP_S_CANCEL;
            else
            {
                if ((startButton & MouseButtons.Left) != 0 && (grfKeyState & ShellAPI.MK.LBUTTON) == 0)
                    retVal = ShellAPI.DRAGDROP_S_DROP;
                else if ((startButton & MouseButtons.Right) != 0 && (grfKeyState & ShellAPI.MK.RBUTTON) == 0)
                    retVal = ShellAPI.DRAGDROP_S_DROP;
                else
                    retVal = ShellAPI.S_OK;
            }

            if (retVal == ShellAPI.DRAGDROP_S_DROP)
                if (BeforeDrop != null)
                    BeforeDrop(this, new EventArgs());

            return retVal;
        }
        public int DragOver(ShellAPI.MK grfKeyState, ShellAPI.POINT pt, ref DragDropEffects pdwEffect)
        {
            bool reset = false;

            #region Get DropItem

            Point point = br.FolderView.PointToClient(new Point(pt.x, pt.y));
            TreeViewHitTestInfo hitTest = br.FolderView.HitTest(point);
            if(!TreeNode.Equals(dropNode, hitTest.Node))
            {
                if(dropTarget != null)
                    dropTarget.DragLeave();

                ReleaseCom();

                dropNode = hitTest.Node;
                br.FolderView.SelectedNode = dropNode;

                if(dropNode == null)
                {
                    pdwEffect = DragDropEffects.None;

                    if(dropHelper != null)
                        dropHelper.DragOver(ref pt, pdwEffect);

                    return ShellAPI.S_OK;
                }
                else
                {
                    ShellItem item = (ShellItem)dropNode.Tag;
                    parentDropItem = item;

                    ShellHelper.GetIDropTarget(item, out dropTargetPtr, out dropTarget);
                    reset = true;
                }
            }
            else if(dropNode == null)
            {
                if(dropTarget != null)
                    dropTarget.DragLeave();

                ReleaseCom();

                dropNode = null;
                br.SelectedNode = null;

                pdwEffect = DragDropEffects.None;

                if(dropHelper != null)
                    dropHelper.DragOver(ref pt, pdwEffect);

                return ShellAPI.S_OK;
            }

            #endregion

            if(dropTarget != null)
            {
                if(reset)
                    dropTarget.DragEnter(dropDataObject, grfKeyState, pt, ref pdwEffect);
                else
                    dropTarget.DragOver(grfKeyState, pt, ref pdwEffect);
            }
            else
                pdwEffect = DragDropEffects.None;

            if(dropHelper != null)
                dropHelper.DragOver(ref pt, pdwEffect);

            return ShellAPI.S_OK;
        }
        public int DragDrop(IntPtr pDataObj, ShellAPI.MK grfKeyState, ShellAPI.POINT pt, ref DragDropEffects pdwEffect)
        {
            OnDrop(new DropEventArgs(mouseButtons, br.FolderView));

            if(!((mouseButtons & ShellAPI.MK.RBUTTON) != 0 ||
                 grfKeyState == ShellAPI.MK.CONTROL ||
                 grfKeyState == ShellAPI.MK.ALT ||
                 grfKeyState == (ShellAPI.MK.CONTROL | ShellAPI.MK.SHIFT)) && ShellItem.Equals(parentDragItem, parentDropItem))
            {
                ResetDrop();
                ReleaseCom();
                pdwEffect = DragDropEffects.None;

                if(dropHelper != null)
                    dropHelper.DragLeave();

                return ShellAPI.S_OK;
            }

            ResetDrop();
            if(dropTarget != null)
            {
                dropTarget.DragDrop(pDataObj, grfKeyState, pt, ref pdwEffect);

                ReleaseCom();
                dropDataObject = IntPtr.Zero;
            }

            if(dropHelper != null)
                dropHelper.Drop(pDataObj, ref pt, pdwEffect);

            return ShellAPI.S_OK;
        }
Exemplo n.º 6
0
 public int OpenStream(string pwcsName, IntPtr reserved1, ShellAPI.STGM grfMode, int reserved2, out IntPtr ppstm)
 {
     return _iStorage.OpenStream(pwcsName, reserved1, grfMode, reserved2, out ppstm);
 }
Exemplo n.º 7
0
 public int MoveElementTo(string pwcsName, IStorage pstgDest, string pwcsNewName, ShellAPI.STGMOVE grfFlags)
 {
     return _iStorage.MoveElementTo(pwcsName, pstgDest, pwcsName, grfFlags);
 }
Exemplo n.º 8
0
 public int Commit(ShellAPI.STGC grfCommitFlags)
 {
     return _iStorage.Commit(grfCommitFlags);
 }
Exemplo n.º 9
0
 public int SetElementTimes(string pwcsName, ShellAPI.FILETIME pctime, ShellAPI.FILETIME patime, ShellAPI.FILETIME pmtime)
 {
     return _iStorage.SetElementTimes(pwcsName, pctime, patime, pmtime);
 }
Exemplo n.º 10
0
 public static DateTime FileTimeToDateTime(ShellAPI.FILETIME fileTime)
 {
     long ticks = (((long)fileTime.dwHighDateTime) << 32) + (long)fileTime.dwLowDateTime;
     return DateTime.FromFileTimeUtc(ticks);
 }
Exemplo n.º 11
0
        /// <summary>
        /// return STATSTG info of a file.
        /// </summary>
        internal static bool getFileStat(IStorage parentStorage, string filename, out ShellAPI.STATSTG statstg)
        {
            IntPtr streamPtr = IntPtr.Zero;
            IStream stream = null;
            statstg = new ShellAPI.STATSTG();

            try
            {
                if (parentStorage.OpenStream(
                            filename,
                            IntPtr.Zero,
                            ShellAPI.STGM.READ,
                            0,
                            out streamPtr) == ShellAPI.S_OK)
                {
                    stream = (IStream)Marshal.GetTypedObjectForIUnknown(streamPtr, typeof(IStream));
                    stream.Stat(out statstg, ShellAPI.STATFLAG.DEFAULT);
                    return true;
                }
            }
            finally
            {
                if (stream != null)
                {
                    Marshal.ReleaseComObject(stream);
                    stream = null;
                }

                if (streamPtr != IntPtr.Zero)
                {
                    Marshal.Release(streamPtr);
                    streamPtr = IntPtr.Zero;
                }

            }
            return false;
        }
Exemplo n.º 12
0
 public static bool IsZip(ShellAPI.SFGAO attribs)
 {
     return ((attribs & ShellAPI.SFGAO.FOLDER) != 0 && (attribs & ShellAPI.SFGAO.STREAM) != 0);
 }
Exemplo n.º 13
0
 /// <summary>
 /// Gets the path to the system special folder identified by the specified enumeration.
 /// </summary>
 public static string GetFolderPath(ShellAPI.CSIDL folder)
 {
     PIDL pidlLookup = CSIDLtoPIDL(folder);
     try
     {
         return FileSystemInfoEx.PIDLToPath(pidlLookup);
     }
     finally { if (pidlLookup != null) pidlLookup.Free(); }
 }
Exemplo n.º 14
0
        public static DragDropEffects CanDropClipboard(ShellItem item)
        {
            IntPtr dataObject;

            ShellAPI.OleGetClipboard(out dataObject);

            IntPtr targetPtr;

            ShellDll.IDropTarget target;

            DragDropEffects retVal = DragDropEffects.None;

            if (GetIDropTarget(item, out targetPtr, out target))
            {
                #region Check Copy
                DragDropEffects effects = DragDropEffects.Copy;
                if (target.DragEnter(
                        dataObject,
                        ShellAPI.MK.CONTROL,
                        new ShellAPI.POINT(0, 0),
                        ref effects) == ShellAPI.S_OK)
                {
                    if (effects == DragDropEffects.Copy)
                    {
                        retVal |= DragDropEffects.Copy;
                    }

                    target.DragLeave();
                }
                #endregion

                #region Check Move
                effects = DragDropEffects.Move;
                if (target.DragEnter(
                        dataObject,
                        ShellAPI.MK.SHIFT,
                        new ShellAPI.POINT(0, 0),
                        ref effects) == ShellAPI.S_OK)
                {
                    if (effects == DragDropEffects.Move)
                    {
                        retVal |= DragDropEffects.Move;
                    }

                    target.DragLeave();
                }
                #endregion

                #region Check Lick
                effects = DragDropEffects.Link;
                if (target.DragEnter(
                        dataObject,
                        ShellAPI.MK.ALT,
                        new ShellAPI.POINT(0, 0),
                        ref effects) == ShellAPI.S_OK)
                {
                    if (effects == DragDropEffects.Link)
                    {
                        retVal |= DragDropEffects.Link;
                    }

                    target.DragLeave();
                }
                #endregion

                Marshal.ReleaseComObject(target);
                Marshal.Release(targetPtr);
            }

            return(retVal);
        }
Exemplo n.º 15
0
        protected override void WndProc(ref Message m)
        {
            if (m.Msg == (int)ShellAPI.WM.SH_NOTIFY)
            {
                ShellAPI.SHNOTIFYSTRUCT shNotify =
                    (ShellAPI.SHNOTIFYSTRUCT)Marshal.PtrToStructure(m.WParam, typeof(ShellAPI.SHNOTIFYSTRUCT));

                //Console.Out.WriteLine("Event: {0}", (ShellAPI.SHCNE)m.LParam);
                //if (shNotify.dwItem1 != IntPtr.Zero)
                //PIDL.Write(shNotify.dwItem1);
                //if (shNotify.dwItem2 != IntPtr.Zero)
                //PIDL.Write(shNotify.dwItem2);

                switch ((ShellAPI.SHCNE)m.LParam)
                {
                    #region File Changes

                case ShellAPI.SHCNE.CREATE:
                    #region Create Item
                {
                    if (!PIDL.IsEmpty(shNotify.dwItem1))
                    {
                        IntPtr parent, child, relative;
                        PIDL.SplitPidl(shNotify.dwItem1, out parent, out child);

                        PIDL      parentPIDL = new PIDL(parent, false);
                        ShellItem parentItem = br.GetShellItem(parentPIDL);
                        if (parentItem != null && parentItem.FilesExpanded && !parentItem.SubFiles.Contains(child))
                        {
                            ShellAPI.SHGetRealIDL(
                                parentItem.ShellFolder,
                                child,
                                out relative);
                            parentItem.AddItem(new ShellItem(br, parentItem, relative));
                        }

                        Marshal.FreeCoTaskMem(child);
                        parentPIDL.Free();
                    }
                }
                    #endregion
                    break;

                case ShellAPI.SHCNE.RENAMEITEM:
                    #region Rename Item
                {
                    if (!PIDL.IsEmpty(shNotify.dwItem1) && !PIDL.IsEmpty(shNotify.dwItem2))
                    {
                        ShellItem item = br.GetShellItem(new PIDL(shNotify.dwItem1, true));
                        if (item != null)
                        {
                            item.Update(shNotify.dwItem2, ShellItemUpdateType.Renamed);
                        }
                    }
                }
                    #endregion
                    break;

                case ShellAPI.SHCNE.DELETE:
                    #region Delete Item
                {
                    if (!PIDL.IsEmpty(shNotify.dwItem1))
                    {
                        IntPtr parent, child;
                        PIDL.SplitPidl(shNotify.dwItem1, out parent, out child);

                        PIDL      parentPIDL = new PIDL(parent, false);
                        ShellItem parentItem = br.GetShellItem(parentPIDL);
                        if (parentItem != null && parentItem.SubFiles.Contains(child))
                        {
                            parentItem.RemoveItem(parentItem.SubFiles[child]);
                        }

                        Marshal.FreeCoTaskMem(child);
                        parentPIDL.Free();
                    }
                }
                    #endregion
                    break;

                case ShellAPI.SHCNE.UPDATEITEM:
                    #region Update Item
                {
                    if (!PIDL.IsEmpty(shNotify.dwItem1))
                    {
                        ShellItem item = br.GetShellItem(new PIDL(shNotify.dwItem1, true));
                        if (item != null)
                        {
                            Console.Out.WriteLine("Item: {0}", item);
                            item.Update(IntPtr.Zero, ShellItemUpdateType.Updated);
                            item.Update(IntPtr.Zero, ShellItemUpdateType.IconChange);
                        }
                    }
                }
                    #endregion
                    break;

                    #endregion

                    #region Folder Changes

                case ShellAPI.SHCNE.MKDIR:
                case ShellAPI.SHCNE.DRIVEADD:
                case ShellAPI.SHCNE.DRIVEADDGUI:
                    #region Make Directory
                {
                    if (!PIDL.IsEmpty(shNotify.dwItem1))
                    {
                        IntPtr parent, child, relative;
                        PIDL.SplitPidl(shNotify.dwItem1, out parent, out child);

                        PIDL      parentPIDL = new PIDL(parent, false);
                        ShellItem parentItem = br.GetShellItem(parentPIDL);
                        if (parentItem != null && parentItem.FoldersExpanded && !parentItem.SubFolders.Contains(child))
                        {
                            ShellAPI.SHGetRealIDL(
                                parentItem.ShellFolder,
                                child,
                                out relative);

                            IntPtr shellFolderPtr;
                            if (parentItem.ShellFolder.BindToObject(
                                    relative,
                                    IntPtr.Zero,
                                    ref ShellAPI.IID_IShellFolder,
                                    out shellFolderPtr) == ShellAPI.S_OK)
                            {
                                parentItem.AddItem(new ShellItem(br, parentItem, relative, shellFolderPtr));
                            }
                            else
                            {
                                Marshal.FreeCoTaskMem(relative);
                            }
                        }

                        Marshal.FreeCoTaskMem(child);
                        parentPIDL.Free();
                    }
                }
                    #endregion
                    break;

                case ShellAPI.SHCNE.RENAMEFOLDER:
                    #region Rename Directory
                {
                    if (!PIDL.IsEmpty(shNotify.dwItem1) && !PIDL.IsEmpty(shNotify.dwItem2))
                    {
                        ShellItem item = br.GetShellItem(new PIDL(shNotify.dwItem1, false));
                        if (item != null)
                        {
                            //Console.Out.WriteLine("Update: {0}", item);
                            item.Update(shNotify.dwItem2, ShellItemUpdateType.Renamed);
                        }
                    }
                }
                    #endregion
                    break;

                case ShellAPI.SHCNE.RMDIR:
                case ShellAPI.SHCNE.DRIVEREMOVED:
                    #region Remove Directory
                {
                    if (!PIDL.IsEmpty(shNotify.dwItem1))
                    {
                        IntPtr parent, child;
                        PIDL.SplitPidl(shNotify.dwItem1, out parent, out child);

                        PIDL      parentPIDL = new PIDL(parent, false);
                        ShellItem parentItem = br.GetShellItem(parentPIDL);
                        if (parentItem != null && parentItem.SubFolders.Contains(child))
                        {
                            parentItem.RemoveItem(parentItem.SubFolders[child]);
                        }

                        Marshal.FreeCoTaskMem(child);
                        parentPIDL.Free();
                    }
                }
                    #endregion
                    break;

                case ShellAPI.SHCNE.UPDATEDIR:
                case ShellAPI.SHCNE.ATTRIBUTES:
                    #region Update Directory
                {
                    if (!PIDL.IsEmpty(shNotify.dwItem1))
                    {
                        ShellItem item = br.GetShellItem(new PIDL(shNotify.dwItem1, true));
                        if (item != null)
                        {
                            item.Update(IntPtr.Zero, ShellItemUpdateType.Updated);
                            item.Update(IntPtr.Zero, ShellItemUpdateType.IconChange);
                        }
                    }
                }
                    #endregion
                    break;

                case ShellAPI.SHCNE.MEDIAINSERTED:
                case ShellAPI.SHCNE.MEDIAREMOVED:
                    #region Media Change
                {
                    if (!PIDL.IsEmpty(shNotify.dwItem1))
                    {
                        ShellItem item = br.GetShellItem(new PIDL(shNotify.dwItem1, true));
                        if (item != null)
                        {
                            item.Update(IntPtr.Zero, ShellItemUpdateType.MediaChange);
                        }
                    }
                }
                    #endregion
                    break;

                    #endregion

                    #region Other Changes

                case ShellAPI.SHCNE.ASSOCCHANGED:
                    #region Update Images
                {
                }
                    #endregion
                    break;

                case ShellAPI.SHCNE.NETSHARE:
                case ShellAPI.SHCNE.NETUNSHARE:
                    break;

                case ShellAPI.SHCNE.UPDATEIMAGE:
                    UpdateRecycleBin();
                    break;

                    #endregion
                }
            }

            base.WndProc(ref m);
        }
Exemplo n.º 16
0
        public int DragOver(ShellAPI.MK grfKeyState, ShellAPI.POINT pt, ref DragDropEffects pdwEffect)
        {
            bool reset = false;

            #region Get DropItem

            Point point = br.FileView.PointToClient(new Point(pt.x, pt.y));
            ListViewHitTestInfo hitTest = br.FileView.HitTest(point);
            if (hitTest.Item != null &&
                (br.FileView.View != View.Details || hitTest.SubItem == null || hitTest.Item.Name == hitTest.SubItem.Name) &&
                (hitTest.Location == ListViewHitTestLocations.Image ||
                 hitTest.Location == ListViewHitTestLocations.Label ||
                 hitTest.Location == ListViewHitTestLocations.StateImage))
            {
                if (!hitTest.Item.Equals(dropListItem))
                {
                    if (dropTarget != null)
                        dropTarget.DragLeave();

                    ReleaseCom();

                    if (dropListItem != null)
                        dropListItem.Selected = wasSelected;

                    dropListItem = hitTest.Item;
                    wasSelected = dropListItem.Selected;
                    dropListItem.Selected = true;

                    ShellItem item = (ShellItem)dropListItem.Tag;
                    parentDropItem = item;

                    ShellHelper.GetIDropTarget(item, out dropTargetPtr, out dropTarget);
                    reset = true;
                }
            }
            else
            {
                if (dropListItem != null)
                {
                    if (dropTarget != null)
                        dropTarget.DragLeave();

                    ReleaseCom();

                    dropListItem.Selected = wasSelected;

                    dropListItem = null;
                    parentDropItem = br.SelectedItem;

                    ShellHelper.GetIDropTarget(br.SelectedItem, out dropTargetPtr, out dropTarget);
                    reset = true;
                }
            }

            #endregion

            if (dropTarget != null)
            {
                if (reset)
                    dropTarget.DragEnter(dropDataObject, grfKeyState, pt, ref pdwEffect);
                else
                    dropTarget.DragOver(grfKeyState, pt, ref pdwEffect);
            }
            else
                pdwEffect = DragDropEffects.None;

            if (dropHelper != null)
                dropHelper.DragOver(ref pt, pdwEffect);

            return ShellAPI.S_OK;
        }
Exemplo n.º 17
0
        public static Environment.SpecialFolder CSIDLToShellFolder(ShellAPI.CSIDL csidl)
        {
            var enumerator = _shellFolderLookupDic.GetEnumerator();

            while (enumerator.MoveNext())
               if (enumerator.Current.Value.Equals(csidl))
                   return enumerator.Current.Key;

            throw new ArgumentException("This CSIDL path not supported");
        }
Exemplo n.º 18
0
 public static extern bool SetMenuItemInfo(
     IntPtr hMenu,
     uint uItem,
     bool fByPos,
     ref ShellAPI.MENUITEMINFO lpmii);
Exemplo n.º 19
0
 public int GetAttributesOf(uint cidl, IntPtr[] apidl, ref ShellAPI.SFGAO rgfInOut)
 {
     checkDisposed();
     return _iShellFolder.GetAttributesOf(cidl, apidl, ref rgfInOut);
 }
Exemplo n.º 20
0
 public int Stat(out ShellAPI.STATSTG pstatstg, ShellAPI.STATFLAG grfStatFlag)
 {
     return _iStorage.Stat(out pstatstg, grfStatFlag);
 }
Exemplo n.º 21
0
 public int GetDisplayNameOf(IntPtr pidl, ShellAPI.SHGNO uFlags, IntPtr lpName)
 {
     checkDisposed();
     return _iShellFolder.GetDisplayNameOf(pidl, uFlags, lpName);
 }
Exemplo n.º 22
0
 public int CreateStream(string pwcsName, ShellAPI.STGM grfMode, int reserved1, int reserved2, out IntPtr ppstm)
 {
     return _iStorage.CreateStream(pwcsName, grfMode, reserved1, reserved2, out ppstm);
 }
Exemplo n.º 23
0
 public int ParseDisplayName(IntPtr hwnd, IntPtr pbc, string pszDisplayName, ref uint pchEaten, out IntPtr ppidl, ref ShellAPI.SFGAO pdwAttributes)
 {
     checkDisposed();
     return _iShellFolder.ParseDisplayName(hwnd, pbc, pszDisplayName, ref pchEaten, out ppidl, ref pdwAttributes);
 }
Exemplo n.º 24
0
 public int OpenStorage(string pwcsName, IStorage pstgPriority, ShellAPI.STGM grfMode, IntPtr snbExclude, int reserved, out IntPtr ppstg)
 {
     return _iStorage.OpenStorage(pwcsName, pstgPriority, grfMode, snbExclude, reserved, out ppstg);
 }
Exemplo n.º 25
0
 public int SetNameOf(IntPtr hwnd, IntPtr pidl, string pszName, ShellAPI.SHGNO uFlags, out IntPtr ppidlOut)
 {
     checkDisposed();
     return _iShellFolder.SetNameOf(hwnd, pidl, pszName, uFlags, out ppidlOut);
 }
Exemplo n.º 26
0
 public int QueryContinueDrag(bool fEscapePressed, ShellAPI.MK grfKeyState)
 {
     if (fEscapePressed)
         return ShellAPI.DRAGDROP_S_CANCEL;
     else
     {
         if ((startButton & MouseButtons.Left) != 0 && (grfKeyState & ShellAPI.MK.LBUTTON) == 0)
             return ShellAPI.DRAGDROP_S_DROP;
         else if ((startButton & MouseButtons.Right) != 0 && (grfKeyState & ShellAPI.MK.RBUTTON) == 0)
             return ShellAPI.DRAGDROP_S_DROP;
         else
             return ShellAPI.S_OK;
     }
 }
Exemplo n.º 27
0
 public int EnumObjects(IntPtr hwnd, ShellAPI.SHCONTF grfFlags, out IntPtr enumIDList)
 {
     checkDisposed();
     return _iShellFolder.EnumObjects(hwnd, grfFlags, out enumIDList);
 }
        public int DragEnter(IntPtr pDataObj, ShellAPI.MK grfKeyState, ShellAPI.POINT pt, ref DragDropEffects pdwEffect)
        {
            mouseButtons = grfKeyState;

            br.FolderView.Focus();
            br.SelectionChange = false;
            lastSelectedNode = br.FolderView.SelectedNode;

            ReleaseCom();

            dropDataObject = pDataObj;

            #region Get DropItem

            Point point = br.FolderView.PointToClient(new Point(pt.x, pt.y));
            TreeViewHitTestInfo hitTest = br.FolderView.HitTest(point);

            dropNode = hitTest.Node;
            br.FolderView.SelectedNode = dropNode;

            if(dropNode != null)
            {
                ShellItem item = (ShellItem)dropNode.Tag;
                parentDropItem = item;

                if(ShellHelper.GetIDropTarget(item, out dropTargetPtr, out dropTarget))
                {
                    dropTarget.DragEnter(pDataObj, grfKeyState, pt, ref pdwEffect);
                }
            }

            #endregion

            if(dropHelper != null)
                dropHelper.DragEnter(br.Handle, pDataObj, ref pt, pdwEffect);

            return ShellAPI.S_OK;
        }
Exemplo n.º 29
0
        public int DragEnter(IntPtr pDataObj, ShellAPI.MK grfKeyState, ShellAPI.POINT pt, ref DragDropEffects pdwEffect)
        {
            mouseButtons = grfKeyState;
            startEffects = pdwEffect;

            br.FileView.Focus();
            br.SelectionChange = false;
            ReleaseCom();

            dropDataObject = pDataObj;

            #region Get DropItem
            Point point = br.FileView.PointToClient(new Point(pt.x, pt.y));
            ListViewHitTestInfo hitTest = br.FileView.HitTest(point);
            if (hitTest.Item != null &&
                (br.FileView.View != View.Details || hitTest.SubItem == null || hitTest.Item.Name == hitTest.SubItem.Name) &&
                (hitTest.Location == ListViewHitTestLocations.Image ||
                 hitTest.Location == ListViewHitTestLocations.Label ||
                 hitTest.Location == ListViewHitTestLocations.StateImage))
            {
                dropListItem = hitTest.Item;

                wasSelected = dropListItem.Selected;
                dropListItem.Selected = true;

                ShellItem item = (ShellItem)dropListItem.Tag;
                parentDropItem = item;

                ShellHelper.GetIDropTarget(item, out dropTargetPtr, out dropTarget);
            }
            else
            {
                dropListItem = null;
                parentDropItem = br.SelectedItem;
                ShellHelper.GetIDropTarget(br.SelectedItem, out dropTargetPtr, out dropTarget);
            }
            #endregion

            if (dropTarget != null)
                dropTarget.DragEnter(pDataObj, grfKeyState, pt, ref pdwEffect);

            if (dropHelper != null)
                dropHelper.DragEnter(br.Handle, pDataObj, ref pt, pdwEffect);

            return ShellAPI.S_OK;
        }
 public DropEventArgs(ShellAPI.MK mouseButtons, Control dragStartControl)
 {
     this.mouseButtons = mouseButtons;
     this.dragStartControl = dragStartControl;
 }
 internal ShellChangeEventArgs(ShellAPI.SHCNE changes, PIDL pidl1, PIDL pidl2)
 {
     Changes = changes; PIDL1 = pidl1; PIDL2 = pidl2;
 }