Exemplo n.º 1
0
        public void DoCut()
        {

            if (IsOldSysListView)
            {
                StringCollection sc = new StringCollection();
                foreach (ShellObject item in SelectedItems)
                {
                    sc.Add(item.ParsingName);
                }
                Clipboard.SetFileDropList(sc);
                IsMoveClipboardOperation = true;
                WindowsAPI.SetFocus(SysListViewHandle);
                int itemCount = WindowsAPI.SendMessage(SysListViewHandle,
                    WindowsAPI.MSG.LVM_GETITEMCOUNT, 0, 0);

                for (int n = 0; n < itemCount; ++n)
                {
                    WindowsAPI.LVITEMA item = new WindowsAPI.LVITEMA();
                    item.mask = WindowsAPI.LVIF.LVIF_STATE;
                    item.iItem = n;
                    item.stateMask = WindowsAPI.LVIS.LVIS_SELECTED;
                    WindowsAPI.SendMessage(SysListViewHandle, WindowsAPI.MSG.LVM_GETITEMA,
                        0, ref item);

                    if (item.state != 0)
                    {
                        WindowsAPI.LVITEMA lvItem = new WindowsAPI.LVITEMA();
                        lvItem.stateMask = WindowsAPI.LVIS.LVIS_CUT;
                        lvItem.state = WindowsAPI.LVIS.LVIS_CUT;
                        WindowsAPI.SendMessage(SysListViewHandle, WindowsAPI.MSG.LVM_SETITEMSTATE, n, ref lvItem);


                    }
                } 
            }
            else
            {
                WindowsAPI.SetFocus(SysListViewHandle);
                SendKeys.SendWait("^x");
            }
            
        }
Exemplo n.º 2
0
        void OnEscKey()
        {
            if (IsOldSysListView)
            {
                int itemCount = WindowsAPI.SendMessage(SysListViewHandle,
                        WindowsAPI.MSG.LVM_GETITEMCOUNT, 0, 0);

                for (int n = 0; n < itemCount; ++n)
                {
                    WindowsAPI.LVITEMA item = new WindowsAPI.LVITEMA();
                    item.mask = WindowsAPI.LVIF.LVIF_STATE;
                    item.iItem = n;
                    item.stateMask = WindowsAPI.LVIS.LVIS_CUT;
                    WindowsAPI.SendMessage(SysListViewHandle, WindowsAPI.MSG.LVM_GETITEMA,
                        0, ref item);

                    if (item.state != 0)
                    {
                        WindowsAPI.LVITEMA lvItem = new WindowsAPI.LVITEMA();
                        lvItem.stateMask = WindowsAPI.LVIS.LVIS_CUT;
                        lvItem.state = 0;
                        WindowsAPI.SendMessage(SysListViewHandle, WindowsAPI.MSG.LVM_SETITEMSTATE, n, ref lvItem);
                    }
                } 
            }
        }