From 5e0ff36205dc6754c3b2cb2b663c0cd0a1df622a Mon Sep 17 00:00:00 2001 From: FellippeHeitor Date: Tue, 31 Jul 2018 22:23:34 -0300 Subject: [PATCH] Adds _ACCEPTFILEDROP as a function to return true (-1) if active/enabled. Returns 0 otherwise. --- internal/c/libqb.cpp | 13 +++++++++++-- internal/c/qbx.cpp | 1 + source/subs_functions/subs_functions.bas | 8 ++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/internal/c/libqb.cpp b/internal/c/libqb.cpp index bbad6e653..8d7a71c8c 100644 --- a/internal/c/libqb.cpp +++ b/internal/c/libqb.cpp @@ -233,6 +233,7 @@ int32 force_display_update=0; void sub__delay(double seconds); void *generic_window_handle=NULL; +int32 acceptFileDrop=0; #ifdef QB64_WINDOWS HWND window_handle=NULL; HDROP hdrop=NULL; @@ -26507,13 +26508,21 @@ void sub__echo(qbs *message){ void sub__filedrop(int32 on_off=NULL) { #ifdef QB64_WINDOWS - if ((on_off==NULL)||(on_off==1)) + if ((on_off==NULL)||(on_off==1)) { DragAcceptFiles((HWND)func__handle(), TRUE); - if ((on_off==2)) + acceptFileDrop=-1; + } + if ((on_off==2)) { DragAcceptFiles((HWND)func__handle(), FALSE); + acceptFileDrop=0; + } #endif } +int32 func__filedrop() { + return acceptFileDrop; +} + void sub__finishdrop() { #ifdef QB64_WINDOWS DragFinish(hdrop); diff --git a/internal/c/qbx.cpp b/internal/c/qbx.cpp index 7d9244661..610fd6011 100644 --- a/internal/c/qbx.cpp +++ b/internal/c/qbx.cpp @@ -100,6 +100,7 @@ uint8**out_data,int32*out_x,int32 *out_y,int32*out_x_pre_increment,int32*out_x_p extern void sub__title(qbs *title); extern void sub__echo(qbs *message); extern void sub__finishdrop(); +extern int32 func__filedrop(); extern void sub__filedrop(int32 on_off=NULL); extern int32 func__totaldroppedfiles(); extern qbs *func__droppedfile(int32 fileIndex, int32 passed); diff --git a/source/subs_functions/subs_functions.bas b/source/subs_functions/subs_functions.bas index f1f95f396..ef9b5000c 100644 --- a/source/subs_functions/subs_functions.bas +++ b/source/subs_functions/subs_functions.bas @@ -908,6 +908,14 @@ id.specialformat = "[{ON|OFF}]" id.NoCloud = 1 regid +clearid +id.n = "_ACCEPTFILEDROP" +id.subfunc = 1 +id.callname = "func__filedrop" +id.ret = LONGTYPE - ISPOINTER +id.NoCloud = 1 +regid + clearid id.n = "_FINISHDROP" id.subfunc = 2