471,337 Members | 931 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

Question About an Event Hook

Hi, had a question about event hooks. I don't know that much about it
so please forgive me if I don't use all the right words. Is it
possible to use a hook that listens or watches a certain
directory/folder and when a new file is put into that directory take
some action.

I have a third party tool. It puts its log files in a directory on the
computer (XP Professional). I need some functionality the third party
does not provide. I can do this by reading the log files. The program
puts a new log file in for each transaction it completes, so what I
thought I could do is read the directory when a new file is put in the
directory and do whatever.

The only other thing I could think of was to use the task scheduler and
have my c# program do what I needed minus the event hook. It just
wouldn't be real time.

Thank you for any help or advice.

Jan 26 '06 #1
3 1498
Check out the FileSystemWatcher class in .Net.
--
Dale Preston
MCAD C#
MCSE, MCDBA
"ne***********@gmail.com" wrote:
Hi, had a question about event hooks. I don't know that much about it
so please forgive me if I don't use all the right words. Is it
possible to use a hook that listens or watches a certain
directory/folder and when a new file is put into that directory take
some action.

I have a third party tool. It puts its log files in a directory on the
computer (XP Professional). I need some functionality the third party
does not provide. I can do this by reading the log files. The program
puts a new log file in for each transaction it completes, so what I
thought I could do is read the directory when a new file is put in the
directory and do whatever.

The only other thing I could think of was to use the task scheduler and
have my c# program do what I needed minus the event hook. It just
wouldn't be real time.

Thank you for any help or advice.

Jan 26 '06 #2
ne***********@gmail.com wrote:
Hi, had a question about event hooks. I don't know that much about it
so please forgive me if I don't use all the right words. Is it
possible to use a hook that listens or watches a certain
directory/folder and when a new file is put into that directory take
some action.

I have a third party tool. It puts its log files in a directory on the
computer (XP Professional). I need some functionality the third party
does not provide. I can do this by reading the log files. The program
puts a new log file in for each transaction it completes, so what I
thought I could do is read the directory when a new file is put in the
directory and do whatever.

The only other thing I could think of was to use the task scheduler and
have my c# program do what I needed minus the event hook. It just
wouldn't be real time.

Thank you for any help or advice.


Research the FileSystemWatcher class. It should be able to provide the
"hooks" you're looking for.

Chris
Jan 26 '06 #3
Hi

The component you are after is called FileSystemWatcher. It is declared in
System.IO namespace and can also be found as a WindowsFroms component in the
VS toolbox.

--
HTH
Stoitcho Goutsev (100)

<ne***********@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Hi, had a question about event hooks. I don't know that much about it
so please forgive me if I don't use all the right words. Is it
possible to use a hook that listens or watches a certain
directory/folder and when a new file is put into that directory take
some action.

I have a third party tool. It puts its log files in a directory on the
computer (XP Professional). I need some functionality the third party
does not provide. I can do this by reading the log files. The program
puts a new log file in for each transaction it completes, so what I
thought I could do is read the directory when a new file is put in the
directory and do whatever.

The only other thing I could think of was to use the task scheduler and
have my c# program do what I needed minus the event hook. It just
wouldn't be real time.

Thank you for any help or advice.

Jan 26 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Luke | last post: by
5 posts views Thread by Wayne Gibson | last post: by
2 posts views Thread by Marinos Christoforou | last post: by
5 posts views Thread by Joe Thompson | last post: by
8 posts views Thread by pigeonrandle | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.