windows.dropfiles: move two words from windows.dragdrop-listener
parent
a236b11dfd
commit
29ef0dcc59
|
@ -5,25 +5,13 @@ USING: accessors alien.accessors alien.data alien.strings
|
|||
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
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
! 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 "" } ;
|
|
@ -1,3 +1,17 @@
|
|||
! 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 ;
|
||||
|
|
Loading…
Reference in New Issue