Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Change Notification

Change Notification

Scheduled Pinned Locked Moved C#
helpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mkomasi
    wrote on last edited by
    #1

    Hi, I want to write a program that send a notififcation when files or folders in a path has been changed. So I've used FindFirstChangeNotification and WaitForMultipleObjects (same as a sample in MSDN document). As I read the document when I use INFINITE for time-out of wait function, it will not be timed out. But in my sample after about one minute, wait function will be timed out. Do you know what's the problem? Mehdi

    H 1 Reply Last reply
    0
    • M mkomasi

      Hi, I want to write a program that send a notififcation when files or folders in a path has been changed. So I've used FindFirstChangeNotification and WaitForMultipleObjects (same as a sample in MSDN document). As I read the document when I use INFINITE for time-out of wait function, it will not be timed out. But in my sample after about one minute, wait function will be timed out. Do you know what's the problem? Mehdi

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      You should be using the FileSystemWatcher component instead. It already wraps all the native functionality up in an easy-to-use component. You can configure the FileSystemWatcher to watch for new, changed, or deleted files and it will fire events when what you want to watch occurs (like changed files or directories) with information about what was changed (one tip: the Changed event is fired three times for each change regardless of file size - after lots of research into event the native methods that the FileSystemWatcher wraps, I still can't figure out why - just make sure your code accomodates that). As far as your problem goes, are you actually doing this using C#? INFINITE is actually a pre-proc definition for 0xffffffff (you could declare this as a const in C#) and if you're passing this as a string, the function will most likely use the default timeout.

      -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups