I am writing a piece of code that monitors files in a directory and copies them onto another directory, by calling other methods etc. I have a setting in the registry that determines the polling intervals. This part of the code is in an endless loop. I have written this as a clean .exe, but now I want to make it a Windows service. I have just started reading on Windows services, and I noticed that the OnStart() function where I had planned to place my code requires that it returns almost immediately (30 seconds). My question therefore is this: How can I then write this bit of code as a service. What do I need to place in the OnStart() function, and still make my application work? Especially since I cant loop indefinitely in the OnStart() function.
Many thanks in advance
Many thanks in advance