Prevent Drag&Drop of files onto 3rd party windows?

Just starting out? Need help? Post your questions and find answers here.
novablue
Enthusiast
Enthusiast
Posts: 165
Joined: Sun Nov 27, 2016 6:38 am

Prevent Drag&Drop of files onto 3rd party windows?

Post by novablue »

I am looking for a simple way to prevent files from being dropped onto third party applications on win10. For example a text file dropped onto the notepad window or onto Firefox. The following code works with programs like notepad however for Firefox it does not. Is there any other way to prevent certain applications to accept files via drag&drop other than using a virtual machine to isolate?

Code: Select all

Hwnd = FindWindow_("Notepad", 0)

Style = GetWindowLong_(Hwnd, #GWL_EXSTYLE)
Style = Style & (~#WS_EX_ACCEPTFILES)
SetWindowLong_(Hwnd, #GWL_EXSTYLE, Style)