Announcement

Collapse
No announcement yet.

Drag & Drop a second time (How to?)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Robert Wallace
    replied
    Rick - many thanks for pointing me in the right direction.

    Bob

    Leave a comment:


  • Richard Angell
    replied
    If you mean dragging and dropping on an drag/drop enabled window(?) have a look at DragQueryFile in the Win32API help. There are examples here in the forums, in POFFs and the PB Samples (IIRC).

    Heres a snip of a function that gets the list of dropped file(s) to an array in response to WM_DROPFILES message (in my program ListDroppedFiles placed the files in a listbox for further use, but ListDroppedFiles can be replaced by the function you need to process the dropped files. (I probably modified a function I found here or in POFFS ... but the memory fades as to where I found the original)

    Code:
    CASE %WM_DROPFILES
                IF GetDroppedFiles(CBWPARAM) THEN ListDroppedFiles CBHNDL
                DragFinish CBWPARAM
    Code:
    FUNCTION GetDroppedFiles(BYVAL hDrop AS LONG) AS LONG
        'Function returns %true, if any files where placed in gDroppedFiles
        LOCAL fCount AS DWORD
        LOCAL fString AS ASCIIZ*%MAX_PATH
        LOCAL n AS LONG
    
        ERASE gDroppedFiles                                             'Erase Global array
                                                                        'Allows Ubound(gDroppedFiles) Check in a
                                                                        'later sub
    
        fCount=DragQueryFile(hDrop,&HFFFFFFFF&,"",BYVAL 0&)              'Get nummer of dropped files
        IF fCount>0 THEN                                                 'Do we really need this check?
            gHasFiles = %true
            REDIM gDroppedFiles(fCount-1)                                'Make room in the global array
            FOR n=0 TO fCount-1
                fString=SPACE$(%MAX_PATH)                               'clear zero terminators
                fCount=DragQueryFile(hDrop,n, fString,LEN(fString)-1)    'put FileName(n) into fString And Get count
                gDroppedFiles(n)=LEFT$(fString,fCount)                   'put count chars into string
                FUNCTION=%True
            NEXT n
    
        END IF
    
    END FUNCTION

    Leave a comment:


  • Robert Wallace
    started a topic Drag & Drop a second time (How to?)

    Drag & Drop a second time (How to?)

    I frequently use Drag & Drop to start my programs using the "Command" command.

    How can I Drag & Drop a second file or folder name? (I know you can select multiple files or folders in the same path, but this is not what I mean.)

    I know it is done with nearly all text Editors.

    lease:

    Many thanks, Bob
Working...
X