use WMI event monitoring objWMIService.ExecNotificationQuery
http://msdn2.microsoft.com/en-us/library/aa393864.aspx
, then pass the event and the file starting the event to your
application via the command line, what I tend to do (so I keep one
monitor running that starts applications at event occurrence)
drawback but also a strength, the application cannot know for sure
that the event has actually happened - this is a possible strength
because then you can have other applications that redefine the
occasion of the event on a file just by starting your application for
handling that event and passing it a file asserted as having been the
object receiving the event (probably too loosely coupled for lots of
people or scenarios though, if this can be a security problem for your
application have to protect against it etc. )
if you absolutely need monitoring and application tightly coupled then
use Python and WMI to do it, using the same method.
http://tgolden.sc.sabren.com/python/wmi.html
Cheers,
Bryan Rasmussen