1. Adding a File Modified Handler
- Posted by SDPringle Aug 02, 2009
- 1079 views
I would like my application to ask Windows to call a routine of mine when a specific file changes. I found a class that does that the problem is it is in the .NET framework. There is no C equivalent documented so I assume that doesn't exist. Is there another way to do the same thing using standard C calls so I can wrap that into EUPHORIA?
Shawn Pringle
2. Re: Adding a File Modified Handler
- Posted by jimcbrown (admin) Aug 02, 2009
- 1099 views
I would like my application to ask Windows to call a routine of mine when a specific file changes. I found a class that does that the problem is it is in the .NET framework. There is no C equivalent documented so I assume that doesn't exist. Is there another way to do the same thing using standard C calls so I can wrap that into EUPHORIA?
Shawn Pringle
The C API appears to be FindFirstChangeNotification() and ReadDirectoryChangesW() - however, this family of functions returns a handle that is meant to be used with WaitForSingleObject() or WaitForMultipleObjects(), so to simulate the asychronous notification you'll have to use a seperate thread that watches the handle and triggers your callback manually.
It's not possible to do this in Eu, but if you write a C dll to be called by Eu (so all the multithreaded handling is done in the dll by pure C code), then this should be fairly simple to do.
http://msdn.microsoft.com/en-us/library/aa365261(VS.85).aspx
3. Re: Adding a File Modified Handler
- Posted by jimcbrown (admin) Aug 02, 2009
- 1140 views
I would like my application to ask Windows to call a routine of mine when a specific file changes. I found a class that does that the problem is it is in the .NET framework. There is no C equivalent documented so I assume that doesn't exist. Is there another way to do the same thing using standard C calls so I can wrap that into EUPHORIA?
Shawn Pringle
The C API appears to be FindFirstChangeNotification() and ReadDirectoryChangesW() - however, this family of functions returns a handle that is meant to be used with WaitForSingleObject() or WaitForMultipleObjects(), so to simulate the asychronous notification you'll have to use a seperate thread that watches the handle and triggers your callback manually.
It's not possible to do this in Eu, but if you write a C dll to be called by Eu (so all the multithreaded handling is done in the dll by pure C code), then this should be fairly simple to do.
http://msdn.microsoft.com/en-us/library/aa365261(VS.85).aspx
This might be worth looking at as well:
4. Re: Adding a File Modified Handler
- Posted by raseu Aug 03, 2009
- 1049 views
Also if you are thinking about cross platform libevent will do the trick