classes.struct io.encodings.utf16n kernel make math namespaces
prettyprint sequences specialized-arrays
ui.gadgets.worlds ui.tools.listener windows.com
-windows.com.wrapper windows.kernel32 windows.ole32
-windows.shell32 windows.types ;
+windows.com.wrapper windows.dropfiles windows.kernel32
+windows.ole32 windows.shell32 windows.types ;
SPECIALIZED-ARRAY: WCHAR
IN: windows.dragdrop-listener
CONSTANT: E_OUTOFMEMORY -2147024882 ! 0x8007000e
-: filecount-from-hdrop ( hdrop -- n )
- 0xFFFFFFFF f 0 DragQueryFile ;
-
-: filenames-from-hdrop ( hdrop -- filenames )
- dup filecount-from-hdrop <iota>
- [
- 2dup f 0 DragQueryFile 1 + ! get size of filename buffer
- dup WCHAR <c-array>
- [ swap DragQueryFile drop ] keep
- utf16n alien>string
- ] with map ;
-
: handle-data-object ( handler: ( hdrop -- x ) data-object -- filenames )
FORMATETC <struct>
CF_HDROP >>cfFormat
--- /dev/null
+! Copyright (C) 2017 Alexander Ilin.
+! See http://factorcode.org/license.txt for BSD license.
+USING: help.markup help.syntax kernel windows.ole32 ;
+IN: windows.dropfiles
+
+HELP: filecount-from-hdrop
+{ $values
+ { "hdrop" null }
+ { "n" null }
+}
+{ $description "" } ;
+
+HELP: filenames-from-hdrop
+{ $values
+ { "hdrop" null }
+ { "filenames" null }
+}
+{ $description "" } ;
! Copyright (C) 2017 Alexander Ilin.
! See http://factorcode.org/license.txt for BSD license.
+USING: alien.data alien.strings io.encodings.utf16n kernel math
+sequences windows.messages windows.shell32 windows.types ;
IN: windows.dropfiles
+
+: filecount-from-hdrop ( hdrop -- n )
+ 0xFFFFFFFF f 0 DragQueryFile ;
+
+: filenames-from-hdrop ( hdrop -- filenames )
+ dup filecount-from-hdrop <iota>
+ [
+ 2dup f 0 DragQueryFile 1 + ! get size of filename buffer
+ dup WCHAR <c-array>
+ [ swap DragQueryFile drop ] keep
+ utf16n alien>string
+ ] with map ;