Home > Net >  For help: WPF drag and drop files after release file is how to determine whether the software for th
For help: WPF drag and drop files after release file is how to determine whether the software for th

Time:09-28

I want to be in WPF implement drag and drop a file from a form, when drag and release for me whether I released the target object file specified software, if it is will open the file, if not specified in the software will do nothing, (for example: I drag and drop from the WPF form a 123. TXT file, release the mouse to determine whether the target software to notepad, if the notepad is directly open 123. TXT the file, if not, then don't do any operation), looking for some information, it is said that want to use the mouse hook, consult everybody a great god how to implement?

CodePudding user response:

I think, drag a file to a software icon automatically using the software to open, should be the function that the software should be implemented according to, rather than by the third party to achieve, you
If a software provided no open the file command?

CodePudding user response:

With what TXT can only use notepad to open? Ie can't open? The tablet can't open?

CodePudding user response:

reference 1st floor songbing774933 response:
, I think, drag a file to a software icon automatically using the software to open, should be the function that the software should be implemented according to, rather than by the third party to achieve, you
If a software provided no open the file command?

My WPF client key customers is to protect the Photoshop some such as: stroke, filter plugin file, such as not to let the user directly to get these files to me,
If drag out directly on the desktop or anywhere else, it will cause customer files are unauthorized use

refer to the second floor shingoscar response:
with what TXT can only be opened with a notepad? Ie can't open? The tablet can't open?


I'm just get TXT, for example, the realization of my WPF itself is dragging Photoshop some such as: stroke, filter plugin file, such as

CodePudding user response:

Others will not save as?

CodePudding user response:

Unless a complete set of software is developed, only their own software to be able to read the file format

CodePudding user response:

Down a MouseLeftButtonDown and UP event, when recorded files, the UP when can know, give it a try?

CodePudding user response:

Certain file extensions can't drag and drop is not finished

CodePudding user response:

refer to the second floor Poopaye response:
with what TXT can only be opened with a notepad? Ie can't open? The tablet can't open?


Why always someone to question the topic "why do you do that," Lord, I think somebody else since asked, there is a reason for certain, want to know is "how to do it,"
If any questions have to understand the "why" fall into two categories, isn't it too much trouble, and indeed some demand is at first glance is not very reasonable but necessary to exist in certain scenarios,

CodePudding user response:

Determine what this icon is selected software seems a little bit difficult,

Refer to the link, didn't study
https://devblogs.microsoft.com/oldnewthing/? P=38393

CodePudding user response:

Hook or GetCursorPos get the mouse coordinates, reoccupy WindowFromPoint get window handle

CodePudding user response:

Uh, you exactly want to drag the explorer on the program icon, or drag on the program

CodePudding user response:

By the way, if you drag on the program, if the program in the DragEnter/DragMove read data, after a judgment has been late again
  •  Tags:  
  • C#
  • Related