Hi,
I'm attempting to write a C++ application that has to keep a watch on certain directories (by polling them every minute or 2). Any idea on how I would do this? My MSDN and Google searches weren't very helpful.
C++ - polling directories every few minutes
- Ron2K
- Forum Technical Administrator
- Posts: 9050
- Joined: 04 Jul 2006, 16:45
- Location: Upper Hutt, New Zealand
- Contact:
C++ - polling directories every few minutes
Kia kaha, Kia māia, Kia manawanui.
OK, I have only done it in .NET.
In Native apps you're going to have to use the API to get a directory listing, and then you can compare it to a saved list.
OR
Just make sure that after you've processed a file, delete it from the directory, so that you know that any files in the directory have to be processed.
I don't know the exact API calls though, so I can't be much help there now.
In Native apps you're going to have to use the API to get a directory listing, and then you can compare it to a saved list.
OR
Just make sure that after you've processed a file, delete it from the directory, so that you know that any files in the directory have to be processed.
I don't know the exact API calls though, so I can't be much help there now.
I don't think you will just find something specific to your question.
You gonna have to manually think of a solution.
First of all the poll interval find a way to code a loop interval in a sperate thread
Then why not google on something that retrieves the contents of a folder structure with the files in it, go with dates (modified, created ect)
I think in c++ there is a scandir command or something that allowes you to do it.
You gonna have to manually think of a solution.
First of all the poll interval find a way to code a loop interval in a sperate thread
Then why not google on something that retrieves the contents of a folder structure with the files in it, go with dates (modified, created ect)
I think in c++ there is a scandir command or something that allowes you to do it.
- Ron2K
- Forum Technical Administrator
- Posts: 9050
- Joined: 04 Jul 2006, 16:45
- Location: Upper Hutt, New Zealand
- Contact:
This is what I've decided to use - after some more searching, I found an article on using timers with the MFC:
http://www.functionx.com/visualc/controls/timer.htm
Now, I'm going to activate the timer, and every time it sends the WM_TIMER message I'll check the directory.
Thanks for all the suggestions though.
http://www.functionx.com/visualc/controls/timer.htm
Now, I'm going to activate the timer, and every time it sends the WM_TIMER message I'll check the directory.
Thanks for all the suggestions though.
Kia kaha, Kia māia, Kia manawanui.