Tuesday, May 29, 2012

How many ways are there to create a File Watcher? Well, here's three at least...

MECUM – .NET TECHNOLOGY BLOG - Daily Problems – How to Write a Filewatcher in Three Possible Ways

image

During my excessive web-sessions regarding .NET I often stumble over questions and articles regarding file monitoring applications. Either as stand-alone applications or in conjunction with Windows Services.

For years know this discussions goes on. With this post I want to show the three methods I have used over the last few years and also give a good usage-scenario for “File Watchers” on Windows.

  • System.IO.FileSystemWatcher – The “Standard” Way
  • Using WMI – Windows Messaging [Management] Instrumentation to Watch Directories
  • The Third and Last Method to Write a FileWatcher – The Windows 7 API-Codepack

image..."

I've known about the first two methods, but the third was new to me. Sure I've known about the Windows API Code Pack for years, just didn't know I could use it this way. I love our industry, there's something to learn every day|hour|minute...

 

Related Past Post XRef:
Windows API Code Pack v1.1 Released (Think “Bug fix, new Shell/Thumbnail/Preview features, VS2010, xUnit, string localization, signed assemblies and more” release)
More Windows Code Pack and Windows 7 developing delightfulness
Windows 7 Code Pack v1.0 Released – Managed code to help get at the yummy Windows 7 filling…
Bridging to Managed Windows 7 Development – Vista Bridge to Windows Code Pack
Vista Bridge v1.4 Released – Now with custom controls for Common File Dialogs, BreadCrumb control and Aero Glass
Vista Bridge (v1.3) available on MSDN Code Gallery
It’s the Bridge to… Vista – Getting and installing Vista Bridge Sample Library

1 comment:

  1. Hi Greg, the last method was also unknown to me, until 3-4 days ago. Thank you for publishing!

    ReplyDelete

NOTE: Anonymous Commenting has been turned off for a while... The comment spammers are just killing me...

ALL comments are moderated. I will review every comment before it will appear on the blog.

Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...

I reserve, and will use, the right to not approve ANY comment for ANY reason. I will not usually, but if it's off topic, spam (or even close to spam-like), inflammatory, mean, etc, etc, well... then...

Please see my comment policy for more information if you are interested.

Thanks,
Greg

PS. I am proactively moderating comments. Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...