 >>
 
 : dragdrop-listener-window ( -- )
-    world get handle>> hWnd>> dup <listener-dragdrop>
+    world get dup <listener-dragdrop>
     +listener-dragdrop-wrapper+ get-global com-wrap [
+        [ handle>> hWnd>> ] dip
         2dup RegisterDragDrop dup E_OUTOFMEMORY =
         [ drop ole-initialize RegisterDragDrop ] [ 2nip ] if
         check-ole32-error

: filecount-from-data-object ( data-object -- n )
    \ filecount-from-hdrop swap handle-data-object ;

TUPLE: listener-dragdrop hWnd last-drop-effect ;

: <listener-dragdrop> ( hWnd -- object )
    DROPEFFECT_NONE listener-dragdrop boa ;

<<

USING: accessors alien.accessors alien.data alien.strings
classes.struct io.encodings.utf16n kernel make math namespaces
prettyprint sequences specialized-arrays
specialized-arrays.instances.alien.c-types.ushort
ui.backend.windows ui.gadgets.worlds ui.gestures
ui.tools.listener windows.com windows.com.wrapper
windows.dropfiles windows.kernel32 windows.ole32 windows.shell32
windows.types ;
SPECIALIZED-ARRAY: WCHAR
IN: windows.dragdrop-listener

