Results 1 to 3 of 3

Thread: Drag&Drop Between 2 ListViews Using OLE

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2002
    Location
    Sydney
    Posts
    4

    Drag&Drop Between 2 ListViews Using OLE

    I'm doing a project that has 2 ListViews and I wanna drag from one and drop to another. It has to be multiple select, and also using OLE ...

    Gime some hint ... or example would be great ..

    Thanks in advance

  2. #2
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Newbury, UK
    Posts
    1,878
    Other people will be able to help with the ListView elements, but here is some info on the OLE drag and drop - typically used when dragging things to and from Windows Explorer.

    the OLEDropMode must be set to:
    1 – Manual
    for every object on the form that wants to receive a dropped file.

    There are different OLExxxx subroutines that can be coded – the only one that is definitely required is the OLEDragDrop routine, which gets run when an item is dropped onto that object on the form.

    The data that has been packaged by the dragged from application / object, is available to the dropped on application / object, although it must be decoded first.
    To identify a list of files from Windows Explorer you can use the following:
    VB Code:
    1. Dim i As Integer
    2.     If Data.GetFormat(15) Then
    3. 'Format 15 is an array of names from WinExplorer
    4.         Add.To.Your.List  Data.Files(1)
    5.         For i = 2 To Data.Files.Count
    6.           Add.To.Your.List  Data.Files(i)
    7.         Next i
    8.         Data.Files.Clear
    9.     End If
    The Format numbers used in the OLE DragDrop data structure, are:
    Text = 1 (vbCFText)
    Bitmap = 2 (vbCFBitmap)
    Metafile = 3
    Emetafile = 14
    DIB = 8
    Palette = 9
    Files = 15 (vbCFFiles)
    RTF = -16639

    If you want to drop files from your application back to Windows Explorer, the following will load the correct data structure with the file names (full names plus path are needed). Remember: Dropping these filenames onto Windows Explorer will initiate a copy operation.
    VB Code:
    1. Data.Files.Add "C:\Temp\Myfile1.TXT", 1
    2. Data.Files.Add "C:\Temp\Yourfile2.TXT", 2
    3. Data.SetData , 15

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2002
    Location
    Sydney
    Posts
    4
    Thanks alot

    That wasn't exactly what I'm after. But still helpful.

    BTW, I fixed that by when startDrag I copy the Item in to the temporary Item. Then when DragDrop i add the temporary Item into the destination listview.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width