Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Which frormat is used for file DRAG to windows explorer ?

Which frormat is used for file DRAG to windows explorer ?

Scheduled Pinned Locked Moved C / C++ / MFC
question
7 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vgrigor
    wrote on last edited by
    #1

    Which frormat is used for file DRAG to windows explorer ? I need to create drag source for moving files by mouse to Windows Explorer. Which format is used for that? Is ther sample of drag source for that puprose ? thanks.

    O 1 Reply Last reply
    0
    • V vgrigor

      Which frormat is used for file DRAG to windows explorer ? I need to create drag source for moving files by mouse to Windows Explorer. Which format is used for that? Is ther sample of drag source for that puprose ? thanks.

      O Offline
      O Offline
      ohadp
      wrote on last edited by
      #2

      You need to create CF_HDROP, which is basically a list of file-names, and store it in your data-object. This looks like a long but helpfull article http://www.codeproject.com/shell/explorerdragdrop.asp.

      V 1 Reply Last reply
      0
      • O ohadp

        You need to create CF_HDROP, which is basically a list of file-names, and store it in your data-object. This looks like a long but helpfull article http://www.codeproject.com/shell/explorerdragdrop.asp.

        V Offline
        V Offline
        vgrigor
        wrote on last edited by
        #3

        Are not you gettting fun? I need drag TO explorer, but not from - that is easy.

        O 1 Reply Last reply
        0
        • V vgrigor

          Are not you gettting fun? I need drag TO explorer, but not from - that is easy.

          O Offline
          O Offline
          ohadp
          wrote on last edited by
          #4

          That's what I said. declare a COleDataSource. allocate memory for a CF_HDROP struct + a list of all your file names hDrop = GlobalAlloc(GMEM_MOVEABLE, bufSize); lock it: pDrop = (DROPFILES*)GlobalLock(hDrop); Fill it Unlock and cache it in your data-source GlobalUnlock(hgDrop); FORMATETC etc = {CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL}; m_dataSrc.CacheGlobalData ( CF_HDROP, hDrop, &etc ); now just call the data-source's DoDragDrop: DROPEFFECT dwEffect = m_dataSrc.DoDragDrop(); and the magic will happen.

          V 1 Reply Last reply
          0
          • O ohadp

            That's what I said. declare a COleDataSource. allocate memory for a CF_HDROP struct + a list of all your file names hDrop = GlobalAlloc(GMEM_MOVEABLE, bufSize); lock it: pDrop = (DROPFILES*)GlobalLock(hDrop); Fill it Unlock and cache it in your data-source GlobalUnlock(hgDrop); FORMATETC etc = {CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL}; m_dataSrc.CacheGlobalData ( CF_HDROP, hDrop, &etc ); now just call the data-source's DoDragDrop: DROPEFFECT dwEffect = m_dataSrc.DoDragDrop(); and the magic will happen.

            V Offline
            V Offline
            vgrigor
            wrote on last edited by
            #5

            I think you typed a good code, /thanks/ but some incomplete, after filing that structure - in which function, (which handler) of which class, I can realize begin DRAG operation ? there are many methods to do it, and some are inconsistent with that way, that need be,as first, found. Please point me which method you meant?

            O 1 Reply Last reply
            0
            • V vgrigor

              I think you typed a good code, /thanks/ but some incomplete, after filing that structure - in which function, (which handler) of which class, I can realize begin DRAG operation ? there are many methods to do it, and some are inconsistent with that way, that need be,as first, found. Please point me which method you meant?

              O Offline
              O Offline
              ohadp
              wrote on last edited by
              #6

              I'm abit confused, but here's my word: You will usually want to begin your drag when someone starts dragging items off a list/tree/any-other control. these controls support drag-notifications (LVN_BEGINDRAG for example). At that point, or at any other point you wish to begin your drag, declare your COleDataSource on the stack. Then do the actions in the previous message (allocate, fill and cache your CF_HDROP data into the data-source). After this simply call dataObject.DoDragDrop() and your drag-drop will begin, when it ends dataObject.DoDragDrop will return. Notice: the destination takes care of performing the operations themselves. So if you're dragging into explorer and drop with a 'copy', explorer will copy the files.

              V 1 Reply Last reply
              0
              • O ohadp

                I'm abit confused, but here's my word: You will usually want to begin your drag when someone starts dragging items off a list/tree/any-other control. these controls support drag-notifications (LVN_BEGINDRAG for example). At that point, or at any other point you wish to begin your drag, declare your COleDataSource on the stack. Then do the actions in the previous message (allocate, fill and cache your CF_HDROP data into the data-source). After this simply call dataObject.DoDragDrop() and your drag-drop will begin, when it ends dataObject.DoDragDrop will return. Notice: the destination takes care of performing the operations themselves. So if you're dragging into explorer and drop with a 'copy', explorer will copy the files.

                V Offline
                V Offline
                vgrigor
                wrote on last edited by
                #7

                thanks you. I only began to work with drag and drop, so methods of use are important for me to note.

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups