ReadDirectoryChangesW question

Discussion in 'Win32' started by Elysia, Aug 31, 2010.

  1. Elysia

    Elysia New Member

    Joined:
    Aug 31, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    I thought I'd try to see if anyone is experienced with monitoring directories here...

    So I have a basic system set up. ReadDirectoryChangesW to read directory changes.
    The only problem I'm facing here is that it returns directly after a new file is added to a directory. If N files are moved into a directory, it will pretty much return N times.
    This is problematic for me since I set off processing whatever files are dumped in asynchronously. And preferably, I want a total count of the files I'm processing, before I start processing (progress stuff).

    So basically it is:
    - Read directory change.
    - Store file added.
    - Wake processing thread.
    - Read new directory chance.
    - Store file added.
    - And so on.

    Ideally, I would like it to be just
    - Read directory change.
    - Store files added.
    - Wake processing thread.

    The only way I can think of doing this is by "peeking" to see if there are more changes waiting to be consumed by a call to ReadDirectoryChangesW since the function blocks until there's a new event.
    Any ideas?
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice