Drag & Drop fails on Windows 10

Hi. I’ve built an app in which I’m opening files (PDF files). I can open the files or Drag & Drop them from outside. If I drag the files in a Mac OS all works fine. If I drag the files in a Windows 7 all works fine. If I do the same in Windows 10, it’s not allowing me to drag the PPD over the window

I’ve entered in the open event of the window the following code:

me.AcceptFileDrop FileTypes.PDF

Of course, I’ve created the Filetype FDF

In the Window, I’ve added a DropObject event with the code for opening the file

I’ve selected in the Build Settings for Windows running the app with Administrator privileges

I’m using Xojo 2019 r3.1

Does anybody know why it’s working fine under MacOS & Windows 7 but not under Windows 10?

Thanks

I tried your steps and my window accepts .pdf , of course it won’t display them because currently the application has no way to render PDF

Do you see a symbol like this during the drag?

If so then are you trying to drag a file from outside of your security zone i.e. is the app running as administrator?

I assume that it is actually defined as PDF and not FDF. If so, when you created the FileType definition, did you remember to include the dot in the extension? Windows will require it.

Brian. This is what I should get and I’m not getting…

Julian. I’m getting this , but in black, not in red. The app is been run as Administrator. What do you mean by “Security zone”?

Dale. I’ve try with .PDF and with PDF for the Filetype definition. In both cases is working fine in Windows 7, but not in Windows 10. I’ve try in 3 different Windows 10, just for ensuring is not a particular PC settings. Of course the User for logging in is Administrator.

User Interface Privilege Isolation. Lower-integrity programs aren’t allowed to send most kinds of messages (such as Drag&Drop) to higher-integrity programs unless the higher-integrity program explicitly allows it.

So it means I’ve to use a Digital Signature for the app. How can I select a Digital Signature in Xojo?. I mean. I can sign Mac Apps with tools like App Wrapper, but Can I use the Apple Developer Certificate for signing a PC app?, what tool should I use for it?.

Thanks

I think you can use ChangeWindowMessageFilter to allow the necessary messages though (like WM_DROPFILES):

Sub Open() // untested Const WM_DROPFILES = &h563 Const MSGFLT_ADD = 1 Declare Function ChangeWindowMessageFilter Lib "User32" (MessageID As UInt32, Flags As Integer) As Boolean Call ChangeWindowMessageFilter(WM_DROPFILES, MSGFLT_ADD) // allow WM_DROPFILES messages through End Sub

Linking Executable
ld: framework not found User32

??

That doesn’t sound like DLL loading error. Maybe a compile error while building for a platform other than Windows?

Maybe that code needs to be

Sub Open()
  #if TargetWindows
    // untested
    Const WM_DROPFILES = &h563
    Const MSGFLT_ADD = 1
    Declare Function ChangeWindowMessageFilter Lib "User32" (MessageID As UInt32, Flags As Integer) As Boolean
    Call ChangeWindowMessageFilter(WM_DROPFILES, MSGFLT_ADD) // allow WM_DROPFILES messages through
  #endif
End Sub

ld indicates the system linker but ld is used on macOS and maybe linux - not windows

Juan, I looked at your original posting again and think the above code is wrong. Look in the IDE’s left window, is the FileType item named correctly? On my system it is “FileTypes1” so the code should read

me.AcceptFileDrop FileTypes1.PDF

It works fine for me on Windows 10

[quote=484228:@Dale Arends]Dale Arends 4 hours ago San Diego, California, USA
@Juan Martorell I’ve entered in the open event of the window the following code:
me.AcceptFileDrop FileTypes.PDF
Juan, I looked at your original posting again and think the above code is wrong. Look in the IDE’s left window, is the FileType item named correctly? On my system it is “FileTypes1” so the code should read

me.AcceptFileDrop FileTypes1.PDF
It works fine for me on Windows 10[/quote]

I’ve double check it and the issue is the same. I’ve created an empty project just with the DropObject event. Here you’ve it. Take a look. It’s working on Mac & Windows 7 but not in Windows 10.

link text

I start thinking the reason is because I’m not signing the software with a certificate, but it’s really surprising for me as I never made it before. Maybe it’s a bug in the new release of Xojo as I’ve recently update it (2019 r3.1)

@Juan:
drop 10 files above your test project…

done ?

Now replace MsgBox with System.DebugLog "OK" or System.DebugLog "Fail"

Run and drop the same set of 10 files…

Better, isn’t it ?

It works on Windows 10 (latest) / Xojo 2015r1 :wink:

So in fact it doesn’t depend on the DropObject event itself. It’s depending on what you make with the object. Of course in my app I’m not just showing a messagebox, I’m sending the object to a Method for opening it.

Then the question would be why Windows 10 is not allowing editing the object or opening a message box and it’s allowing internal debug logs?

What should I avoid for letting the code to skip the windows block?.

Best regards.

Juan, your program works on my Windows 10, I can drag PDF over the app and get a message box with Ok.
I can’t drag other type of files. Using Xojo2019r3.1

[quote=484277:@Alberto DePoo]Alberto DePoo 12 seconds ago Testers, Xojo Pro Austin, Texas
Juan, your program works on my Windows 10, I can drag PDF over the app and get a message box with Ok.
I can’t drag other type of files. Using Xojo2019r3.1[/quote]

Ahhhhhhhhh… I believe I’ve discover it… As I post previously maybe it’s a BUG of the new Xojo2019r3.1. If I compile the software from MacOS version of Xojo, then the Windows app is not allowing the Drag & Drop. If I compile the same code from the Windows version of Xojo, the the Windows app is allowing the Drag & Drop. This was working fine in previous versions, so seems it’s to be an specific bug of the MacOS version when compiling for Windows.

I was becoming crazy with this… Thanks a lot to all for helping me on discovering when the bug was.

Juan, downloaded your code, build on Mac for Windows 64 bit, transferred to Windows 10, ran the program and it works.
Build with Xojo2019r3.1 on Mac.

Edit: I don’t know if the macOS version can have something to do, I’m running 10.14.6

Two hours ago, I started to download Xojo 2019r3.1 for Windows and once the download was done (a minute ago), I loaded your example and I confirm: it works as is on Windows 10 1909 (all updates installed).

Running in the IDE.

BTW: I loved the .exe icon !