Hi. Ive built an app in which Im 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, its not allowing me to drag the PPD over the window
Ive entered in the open event of the window the following code:
me.AcceptFileDrop FileTypes.PDF
Of course, Ive created the Filetype FDF
In the Window, Ive added a DropObject event with the code for opening the file
Ive selected in the Build Settings for Windows running the app with Administrator privileges
Im using Xojo 2019 r3.1
Does anybody know why its working fine under MacOS & Windows 7 but not under Windows 10?
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?.
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
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
[quote=484228:@Dale Arends]Dale Arends 4 hours ago San Diego, California, USA @Juan Martorell Ive 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.
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)
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?.
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.
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).