filesystemwatcher on 98

  • Thread starter Thread starter Trapulo
  • Start date Start date
T

Trapulo

Is there any way to use filesystemwatcher on windows 98/me? Any workaround
to write a software that uses it on win2K/xp and some other solution on
98/me?

I need to receive an event when a new file is created.

thanks
 
Hi Trapulo,

Based on my understanding, you want to be notified when the file system on
Win98/Me is changed.

Yes, you can not use FileSystemWatcher class, because internally, it
encapsulates ReadDirectoryChangesW Win32 API, which only existed on WinNT
series OS.

In Win98/Me, I think you may P/invoke win32 API FindFirstChangeNotification
to get what you want, for more information, please refer to:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base
/findfirstchangenotification.asp

and a sample at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base
/obtaining_directory_change_notifications.asp

==============================
Please apply my suggestion above and let me know if it helps resolve your
problem.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Thanks, I made some of this (a process that reads directory and then sleeps
for a while).
 
"Jeffrey Tan[MSFT]" said:
Hi Trapulo,

Based on my understanding, you want to be notified when the file system on
Win98/Me is changed.

Yes.
In fact I need only the be notified when a file is created, because then I
process and delete it.
Yes, you can not use FileSystemWatcher class, because internally, it
encapsulates ReadDirectoryChangesW Win32 API, which only existed on WinNT
series OS.

I understand.
In Win98/Me, I think you may P/invoke win32 API FindFirstChangeNotification
to get what you want, for more information, please refer to:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base
/findfirstchangenotification.asp

and a sample at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base
/obtaining_directory_change_notifications.asp


Thanks.
As workaround I've implemented a thread that readd directory and then sleep
for a while, with internal state to avoid raising multiple events for same
file. Now I see if is it better to switch to p/invoke based implementation.

bye
 
Hi Trapulo,

Thanks for your feedback.

Yes, using timer control may meet your need if you do not need much
precision. If you need further help, please feel free to post. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top