DLL process that runs at the same time every day to check files

I would like to create a "DLL" process that starts every day at 6 PM and looks for new XML files in the folder path. But I do understand how to implement this.

The only way to use a "timer" that starts on the first day at 6 PM and has a 24 hour interval like this?

System.Timers.Timer _myTime = new System.Timers.Timer();



private bool SetTimer(double intervall)
        {
            try
            {
                _myTime.Interval = intervall;
                _myTime.Elapsed += _myTime_Elapsed;
                _myTime.Enabled = true;
                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }

    void _myTime_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
    {
        try
        {
            //do something to search for new XML files and copy them to a new file or so....
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
        }

      

+3


source to share


1 answer


You don't need to incorporate scheduling into your programming logic. Just write and post your code. You can now use the Windows Task Scheduler to implement scheduling. Just choose which program to run and when.



This can help.

+2


source







All Articles