CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2002
    Posts
    214

    simulate file drag&drop..

    hi, gurus

    i want to implement file drag& drop between my 2 programs. Also, my program can accept the dropped files which were dragged from the windows explorer.

    Now, in another program i want to implement file dragging operation, like the behavior of windows explorer.

    But I have no idea about the 'CF_HDROP' data format. Could anyone tell me how to do such job?

    your help will be appreciated.

    thanks..

  2. #2
    Join Date
    Mar 2004
    Posts
    27
    try to WM_DROPFILES

  3. #3
    Join Date
    Dec 2002
    Posts
    214
    WM_DROPFILES was sent a window when a set of files was dropped on it.

    But i am not asking this question, what i am asking for is that how to implement the DRAG&DROP data source of such operation.

    Anybody can help me?

    thanks.

  4. #4
    Join Date
    Jan 2004
    Location
    Bangalore
    Posts
    53

    write a Drag N Drop handler

    Try to write a Drag & Drop handler. Its a Shell extension. You can drag a file from windows explorer and drop it in your application.
    Search for windows shell extensions.

  5. #5
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,633

    Re: simulate file drag&drop..

    Originally posted by wuyh
    But I have no idea about the 'CF_HDROP' data format. Could anyone tell me how to do such job?
    MSDN

    CF_HDROP
    This clipboard format is used when transferring the locations of a group of existing files. Unlike the other Shell formats, it is predefined, so there is no need to call RegisterClipboardFormat. The data consists of an STGMEDIUM structure that contains a global memory object. The structure's hGlobal member points to a DROPFILES structure as its hGlobal member.

    The pFiles member of the DROPFILES structure contains an offset to a double NULL-terminated character array containing the file names. If you are extracting a CF_HDROP format from a data object, you can use DragQueryFile to extract individual file names from the global memory object. If you are creating a CF_HDROP format to place in a data object, you will need to construct the file name array.

    The file name array consists of a series of strings, each containing one file's fully qualified path, including the terminating NULL character. An additional NULL character is appended to the final string to terminate the array. For example, if the files c:\temp1.txt and c:\temp2.txt are being transferred, the character array looks like this.

    c:\temp1.txt'\0'c:\temp2.txt'\0''\0'

    Note In this example, '\0' is used to represent the NULL character, not the literal characters that should be included.
    If the object was copied to the clipboard as part of a drag-and-drop operation, the pt member of the DROPFILES structure contains the coordinates of the point where the object was dropped. You can use DragQueryPoint to extract the cursor coordinates.

    If this format is present in a data object, an OLE drag loop simulates WM_DROPFILES functionality with non-OLE drop targets. This is important if your application is the source of a drag-and-drop operation on a Microsoft® Windows® 3.1 system.

    Note This format supports both ANSI and Unicode. However, only ANSI file paths can be used with Windows 95 systems.
    Best regards,
    Igor

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

Featured