Win32 Service for FileChangeNotification
I currently try to write a windows service that acts on filechanges in a specified directory (yes a filemonitoring tool)
I wrote an application (the out commented part at the bottom of main.c) thzat worked quiet well. I also wrote a service doing beep()s and it also did great.
now I need to combine the two.
all compiles just fine,
with 'ca.exe install' the service gets registered and with 'ca.exe uninstall' the service gets removed.
I pass the following arguments as needed to the service before starting it manually: '-fs c:\\Temp'. these are needed by my application, meaning that the application should act on changes to the filesize or changedate within c:\Temp (you have to escape the backslash with another one so \\ is ok).
as stated before the service starts and runs fine only it does not react on changes. nothing happenes except that every bunch of minutes lots of entries are made to c:\temp\test.txt (my log file) stating 'WAIT_FAILED'..
I think the mistake I made lies in some timing. I call the WaitForSingleObject() within the services while loop, but I can not say what causes the problem. maybe you can?
please be gentle with me, since I am pretty n00b to windows programming. in fact this is the first win32 code I ever did.. :-/
thanks in advance!
platform is windows nt4
ide is devcpp
compoiler is mingw