1. Adding a File Modified Handler

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

new topic     » topic index » view message » categorize

2. Re: Adding a File Modified Handler

SDPringle said...

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

new topic     » goto parent     » topic index » view message » categorize

3. Re: Adding a File Modified Handler

jimcbrown said...
SDPringle said...

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:

http://www.codeproject.com/KB/files/DirCheck.aspx

new topic     » goto parent     » topic index » view message » categorize

4. Re: Adding a File Modified Handler

Also if you are thinking about cross platform libevent will do the trick

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu