Professional Web Applications Themes

Drag and Drop in Windows with Explorer - Ruby

--=-T+JD42+kFl7VYWdJPGTV Content-Type: text/plain Content-Transfer-Encoding: 7bit I need to make a Windows program with RXRuby that batch processes audio files, after the user drags them from Explorer to the program's window. This works easily in Linux, I just accept "text/uri-list". I was trying to find the Windows equivalent, so I wrote some code to list the offered types, which also works great in Linux. But in Windows (I tried XP and 98SE), when dragging files from Explorer, I don't even get a SEL_DND_MOTION. My code is attached. Is it possible to get dropped files in Windows, and if so, how? Thanks, ...

  1. #1

    Default Drag and Drop in Windows with Explorer


    --=-T+JD42+kFl7VYWdJPGTV
    Content-Type: text/plain
    Content-Transfer-Encoding: 7bit

    I need to make a Windows program with RXRuby that batch processes audio
    files, after the user drags them from Explorer to the program's window.

    This works easily in Linux, I just accept "text/uri-list". I was trying
    to find the Windows equivalent, so I wrote some code to list the offered
    types, which also works great in Linux. But in Windows (I tried XP and
    98SE), when dragging files from Explorer, I don't even get a
    SEL_DND_MOTION. My code is attached.

    Is it possible to get dropped files in Windows, and if so, how?

    Thanks,
    --
    Tom Felker <tcfelkermtco.com>

    --=-T+JD42+kFl7VYWdJPGTV
    Content-Disposition: attachment; filename=filedropper.rb
    Content-Type: text/plain; name=filedropper.rb; cht=iso-8859-1
    Content-Transfer-Encoding: 7bit

    #!/usr/bin/env ruby

    require "fox"
    include Fox

    class FileDropper < FXMainWindow

    def initialize(app)
    super(app, "FileDropper", nil, nil, DECOR_ALL, 0, 0, 200, 150)
    dropEnable

    connect(SEL_DND_DROP) do
    puts "\nSEL_DND_DROP"
    puts getDNDData(FROM_DRAGNDROP, FXWindow.urilistType)
    end

    connect(SEL_DND_MOTION) do
    puts "\nSEL_DND_MOTION"
    inquireDNDTypes(FROM_DRAGNDROP).each do |t|
    puts getApp().getDragTypeName(t)
    end
    if offeredDNDType?(FROM_DRAGNDROP, FXWindow.urilistType)
    acceptDrop
    end
    end

    end

    def create
    super
    FXWindow.urilistType = getApp().registerDragType(FXWindow.urilistTypeName )
    show(PLACEMENT_SCREEN)
    end
    end

    app = FXApp.new("FileDropper", "FXRuby")
    FileDropper.new(app)
    app.create
    app.run


    --=-T+JD42+kFl7VYWdJPGTV--


    Tom Felker Guest

  2. #2

    Default Re: Drag and Drop in Windows with Explorer

    Hi Tom,

    Sorry, I don't have an answer to your question. I had a quick play with this some time back and didn't get anywhere.

    If you get the code to work under Windows, can you post the final version to the mailing list?

    Cheers,

    Harry O.


    Harry Ohlsen Guest

  3. #3

    Default Re: Drag and Drop in Windows with Explorer

    On Mon, 2003-06-30 at 19:53, Harry Ohlsen wrote:
    > Hi Tom,
    >
    > Sorry, I don't have an answer to your question. I had a quick play with this some time back and didn't get anywhere.
    >
    > If you get the code to work under Windows, can you post the final version to the mailing list?
    >
    > Cheers,
    >
    > Harry O.
    Sure, I'll post any working code I get, but I'm a bit discouraged by my
    further research:

    <http://www.escribe.com/software/foxusers/m4610.html>

    According to this, on Windows, Fox does DND in it's own way, not
    Window's way, because OLE is too weird to be cross-platform.
    Unfortunately, Windows developers, and certainly Microsoft, won't jump
    to change their DND to work with Fox.

    <http://www.escribe.com/software/foxusers/m4066.html>
    <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/programmersguide/legacyinformation/shelllib.asp>

    However, while most of Windows uses OLE or COM or some other hip TLA,
    there's also a special API for file dropping, and this person hacked up
    a way to do this in C++. This can be done in plain Ruby and FXRuby,
    given the ability:

    - To call Windows functions (Yes)
    - To access a given FXWindow's handle (Maybe)
    - To intercept the WM_DROPFILES message and extract wParam (Maybe)
    - To work with pointers to pre-allocated buffers. (Yes)

    I might be able to hack this up tomorrow, if FXRuby and Fox let me get
    low enough access. I know it's possible in C++, but I can only hope
    FXRuby exports enough to intercept messages and get handles.

    If I were a Fox hacker, I'd say they should use this simpler API to
    emulate Fox's DND, by sending synthetic messages and making it look like
    "text/uri-list".

    --
    Tom Felker <tcfelkermtco.com>


    Tom Felker Guest

Similar Threads

  1. Drag and Drop controls during runtime in Windows App
    By mattgcon@yahoo.com in forum ASP.NET Building Controls
    Replies: 0
    Last Post: December 1st, 10:01 PM
  2. Drag and Drop from VB6 onto a pdf ?
    By Jay_Hutchinson@adobeforums.com in forum Adobe Acrobat SDK
    Replies: 0
    Last Post: July 7th, 08:49 PM
  3. Drag and drop using drag manager
    By mmahuika in forum Macromedia Flex General Discussion
    Replies: 4
    Last Post: March 28th, 05:03 PM
  4. Drag & Drop using Internet Explorer
    By Ray at in forum ASP
    Replies: 1
    Last Post: October 10th, 03:07 PM
  5. drag/drop
    By bob biebrich in forum Windows XP/2000/ME
    Replies: 4
    Last Post: July 23rd, 01:34 AM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139