none
Explorer file cut/copy and Forms::Clipboard

    Question

  • Any idea how to determine which option was used by user (cut/copy) when I'm getting file list from clipboard:

    for(int i=0;i<Clipboard::GetFileDropList()->Count;i++){

    MessageBox::Show((String^)Clipboard::GetFileDropList()[ i ]);

    }

    Saturday, February 03, 2007 12:42 PM

Answers

  • This worked well:

        private void button1_Click(object sender, EventArgs e) {
          if (!Clipboard.GetDataObject().GetDataPresent("Preferred Dropeffect"))
            Console.WriteLine("No shell data present");
          else {
            System.IO.Stream strm = (System.IO.Stream)Clipboard.GetData("Preferred Dropeffect");
            DragDropEffects value = (DragDropEffects)strm.ReadByte();
            if ((value & DragDropEffects.Move) == DragDropEffects.Move)
              Console.WriteLine("Cut was used");
            else if ((value & DragDropEffects.Copy) == DragDropEffects.Copy)
              Console.WriteLine("Copy was used");
            else
              Console.WriteLine("Unknown command was used");
          }
        }

    Saturday, February 03, 2007 2:47 PM

All replies

  • This worked well:

        private void button1_Click(object sender, EventArgs e) {
          if (!Clipboard.GetDataObject().GetDataPresent("Preferred Dropeffect"))
            Console.WriteLine("No shell data present");
          else {
            System.IO.Stream strm = (System.IO.Stream)Clipboard.GetData("Preferred Dropeffect");
            DragDropEffects value = (DragDropEffects)strm.ReadByte();
            if ((value & DragDropEffects.Move) == DragDropEffects.Move)
              Console.WriteLine("Cut was used");
            else if ((value & DragDropEffects.Copy) == DragDropEffects.Copy)
              Console.WriteLine("Copy was used");
            else
              Console.WriteLine("Unknown command was used");
          }
        }

    Saturday, February 03, 2007 2:47 PM
  • Thank you!
    Saturday, February 03, 2007 3:11 PM