Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use SHChangeNotifyRegister to monitor directories for changes #106

Open
derceg opened this issue Mar 23, 2018 · 0 comments
Open

Use SHChangeNotifyRegister to monitor directories for changes #106

derceg opened this issue Mar 23, 2018 · 0 comments
Labels
Milestone

Comments

@derceg
Copy link
Owner

@derceg derceg commented Mar 23, 2018

ReadDirectoryChangesW

Currently, ReadDirectoryChangesW is used to monitor directories for changes. There are a few disadvantages of using this method:

  • It only monitors filesystem folders. Directories such as the recycle bin can't be monitored (see #103).
  • The current implementation uses a background thread, which introduces extra complexity.

SHChangeNotifyRegister

SHChangeNotifyRegister is an alternative way of monitoring directories for changes. It has the following advantages compared to ReadDirectoryChangesW:

  • All directories can be monitored. The function accepts a pidl, rather than a folder handle.
  • Change notifications are sent as window messages, meaning there would only be a single thread involved.

Known issues

  • In Windows 7 at least, no change notifications appear to be sent for the Recycle Bin unless the user has the folder open in Windows Explorer. Even if reliably monitoring the recycle bin for changes isn't possible, using SHChangeNotifyRegister should still be beneficial, as it will allow other non-filesystem directories (e.g. library folders) to be monitored properly.
@derceg derceg added the enhancement label Mar 23, 2018
@derceg derceg added this to the v1.5 milestone Mar 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.