How to detect when any file is being attached/uplo

2019-09-17 23:05发布

问题:

When any file is attached to email in browser or any email client, how to detect the event? What is the process running in windows or browser when the file is being attached? In other words what is the process for uploading of files? How to detect that process from c# code? Is there any way to detect this event or process using FileSystemWatcher?

回答1:

Simply speaking, there is not. All uploading a file does is open it,so the best you could do in theory is find the process that was opening the file and use heuristics. However FileSystemWatcher is for monitoring changes to files, and the closest you could get to finding out which process was opening a file would be constantly polling it's status using the external tool handle.exe in C#, or NtQuerySystemInformation in C++.