Drag and drop from Windows File Explorer onto a Windows Form is not working

后端 未结 4 1761
一生所求
一生所求 2021-02-09 01:41

I\'m having an issue dragging a file from Windows Explorer on to a Windows Forms application.

It works fine when I drag text, but for some reason it is not recognizing

4条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-09 02:38

    The problem comes from Vista's UAC. DevStudio is running as administrator, but explorer is running as a regular user. When you drag a file from explorer and drop it on your DevStudio hosted application, that is the same as a non-privileged user trying to communicate with a privileged user. It's not allowed.

    This will probably not show up when you run the app outside of the debugger. Unless you run it as an administrator there (or if Vista auto-detects that it's an installer/setup app).

    You could also run explorer as an admin, at least for testing. Or disable UAC (which I would not recommend, since you really want to catch these issues during development, not during deployment!)

提交回复
热议问题