Hi Chris,
unfortunately it does not work.I made all the changes to Longptr
I am using your code in two windows, in none of them the pbm_dropfiles event ( = ue_dropfiles) fires. In debugging mode I set a breakpoint at the beginning of the event, but it never stops there.
Here is the code:
LOCAL EXTERNAL FUNCTIONS
FUNCTION ulong DragQueryFile(Longptr al_hDrop, ulong ai_File, REF string as_FileName, ulong ai_cb) LIBRARY "shell32.dll" alias for "DragQueryFileW"
SUBROUTINE DragAcceptFiles(Longptr l_hWnd,boolean fAccept) LIBRARY "shell32.dll" // alias for "DragAcceptFiles"
SUBROUTINE DragFinish(ulong hDrop) LIBRARY "shell32.dll" Alias for "DragFinish"
IN OPEN EVENT of the Window:
Postevent("ue_enabledrag")
IN EVENT UE_ENABLE_DRAG:
DragAcceptFiles(handle(this), true)
IN EVENT UE_DROPFILES with Event_ID pbm_dropfiles:
String ls_path
String ls_temp
ulong lul_file, lul_max_files
Long ll_pos1,ll_pos2
Constant ULong lul_hex = 4294967295
ULong lul_pathSize = 1023
ulong lul_index
ls_path = Space(lul_pathSize)
lul_max_files = DragQueryFile(handle, lul_hex, ls_path, lul_pathSize)
IF lul_max_files > 0 THEN
DO WHILE lul_index >= 0 and lul_index < lul_max_files
ls_path = Space(lul_pathSize)
lul_file = DragQueryFile(handle, lul_index, ls_path, lul_pathSize)
IF lul_file > 0 THEN
fw_import(ls_path)
lul_index++
ELSE
lul_index = -1
END IF
LOOP
END IF
DragFinish(handle)
If Roland & My examples work in PB 2022 build 1892 then your App should as well ... IF, you followed the same coding approach.
Unfortunately without seeing your App code implementation, it's hard to advise you further.
Regards ... Chris
In your FileDrop Application code I found
IF IsUserAnAdmin() THEN DragrDrop does not work
I made the same test in my application and it says: I am an Admin.
Could this be the cause, my Drag&Drop does not work any longer?
Why am I an Admin in my application, but not in your FileDrop application?
Have a nice weekend
Best regards
Stephan
I put that check into the framework when I updated to PB 2019 and higher when testing on W10 22H1 as external file drops stopped working when I was running my PB App in Admin Mode. Now that we are on PB 2022 wit W1- & W11 version 22H2, I have not retested that aspect to see if that O/S behaviour (restriction) has been lifted by MS.
PS: PB2022 is also now compiled with VC++ 2019 vs VC++ 2010 in PB 2019/2021 - so that might make a difference now as well.
Regards ... Chris