Does anyone have a FileSystemWatcher-like class in C++/WinAPI?

前端 未结 4 1693
一个人的身影
一个人的身影 2020-12-09 05:52

I need a .Net\'s FileSystemWatcher analog in raw C++/WinAPI. I almost started to code one myself using FindFirstChangeNotification/FindNextChangeNotification, but then it oc

相关标签:
4条回答
  • 2020-12-09 06:04

    What about the ReadDirectoryChangesW function?

    http://msdn.microsoft.com/en-us/library/aa365465(VS.85).aspx

    It stores notifications in a buffer so you don't miss any changes (unless the buffer overflows)

    0 讨论(0)
  • 2020-12-09 06:05

    This is a cross platform solution, but does the job wrapping the Win32 stuff nicely: https://code.google.com/p/simplefilewatcher/

    0 讨论(0)
  • 2020-12-09 06:13

    http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.created%28v=vs.71%29.aspx the above does throgh C#, we can always write a COM Wrapper

    0 讨论(0)
  • 2020-12-09 06:20

    There is some public-domain code here. My current project uses this (inherited from previous developers). It works pretty well but we do miss notifications for reasons that are unclear (and possibly not caused by this code).

    Note that the Win32 API here has some limitations which make it difficult/impossible to avoid missing notifications. Background and alleged work-round for the API are here

    0 讨论(0)
提交回复
热议问题